Workflow not working: SuiteCRM installed on CentOS-6.3 64bit

Dear sir,

I am writing for help!!!

I have installed SuiteCRM on CentOS 6.3 64bit and have tried whatever I learned from the web to get workflows running but unluckily all the time-elapsed (time-bounded) workflows can not be triggered automatically.

I have added the following line to my crontab file (file name “root” as I have this only user for the Linux system):

1/* 1/* * * * cd /a/domains/crm.softpowerworks.com/public_html; php -f cron.php > /dev/null 2>&1

and my schedulers are working.

Please anyone can help me on this?

Thanks a lot!!

Chris

SuiteCRM version?

Please post one or two pictures with the EditView of your workflow and explain what you want it to do and how you want it to trigger.

Check your schedulers to see if they are running (this helps understand if cron jobs are set correctly.

Check suitecrm.log and sugarcrm.log as well as webserver/php error logs and post all you find

Have you set file/folders permissions and system owner/group correctly? Please specify how you have done it and also check that you have obtained the desired effect.

What user is running cron jobs? It should be the same as SuiteCRM system owner/group.

1 Like

Many thanks for your comment and help.

I think maybe my was related to the point in your last question “What user is running cron jobs? It should be the same as SuiteCRM system owner/group.”. How can I set the cron jobs user? In my CentOS system there is one only user “root”. My administrative user for my SuiteCRM is “admin”.

Shall I set a user in CentOS system called “admin”? How can I do that? And How can I make sure “admin” in CentOS is related to “admin” in SuiteCRM?

Thanks a lot!!!

Wish you all the best.

Chris

Have a look at @pgr’s blog. He wrote an article on the topic:
https://pgorod.github.io/Scheduler-Jobs/

Thanks again for help.

I have read that article again and again but I can not get what it said.

My SuiteCRM version is 7.8.2. I can not find the “allowed cron user” in the phpinfo file as this is NO APACHE_RUN_USER in it.

Can you please help me on my specific situation:

  1. I have ftp user for SuiteCRM installation called “webcrm” and this user is for also the user for MySql access;
  2. I have administrative user for SuiteCRM system called “admin.” It can log into SuiteCRM and have administrative right on the system.
  3. I have the Linux user “root” who can do anything on the Linux system “CentOS 6.3 64bit”.
  4. In the Linux system, under “/var/spool/cron/” there is a file “root” which I believe is the cron file for the Linux system.

My question is:

  1. Where shall I add the "* * * * * cd /a/domains/crm.softpowerworks.com/public_html; php -f cron.php > /dev/null 2>&1 " to? I tried to add it into the “root” file under “/var/spool/cron/” and it does not work

  2. Shall I add a user called “webcrm” (the ftp installation user) or “admin” (the SuiteCRM admin user" can get related cron file under “/var/spool/cron/”? and then put "* * * * * cd /a/domains/crm.softpowerworks.com/public_html; php -f cron.php > /dev/null 2>&1 " into that file?

Please advise.

Milliions of thanks.

Chris

Use option number 3 under this question “And how can I find out which user my web server runs under?” to find out your web server user.

Then do
sudo crontab -e -u thatUser

to edit the correct crontab.

Thanks for comment.

I have done the steps in option number 3 and I can not find “APACHE_RUN_USER” in the produced phpin() file. That is why I can not know which user I should use for cron jobs.

Actually I tried also do
sudo crontab -e -u thatUser

and I change all possible names I used for SuiteCRM for “thatUser” and I can only get result when the user name is “root”. And “root” is the linux root user, not SuiteCRM web user (for ftp use) or SuiteCRM system admin user “admin”

What shall I do?

Pleas help.

thanks.

The user is surely there in phpinfo(), maybe it’s not called APACHE_RUN_USER, but search for user and see if yo can make sense of it…

Also please try this
sudo cat /etc/crontab

and post the results.

I used “user” to search phpinfo() and what I see is either “no value” or “user.ini” or “nginx”…

after I did sudo cat /etc/cronta I got the following (sorry I have problem on attached photos here);

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

For details see man 4 crontabs

Example of job definition:

.---------------- minute (0 - 59)

| .------------- hour (0 - 23)

| | .---------- day of month (1 - 31)

| | | .------- month (1 - 12) OR jan,feb,mar,apr …

| | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat

| | | | |

* * * * * user-name command to be executed

That looks like a system-wide crontab (I mention it on my article). You can get your command working there, there’s a column for the username. This way you don’t have to use root’s crontab (which is bad practice).

“nginx” is a possible user name that your web server uses, I’ve heard of that on other systems.

So taking your command above you could use something like

          • nginx cd /a/domains/crm.softpowerworks.com/public_html; php -f cron.php > /dev/null 2>&1

Notice I have added the username after the asterisks.

Sometimes a simple way to learn your web server user is to simply run
ls -al
on your SuiteCRM directory and see which user owns suitecrm.log.

Yes it is a system-wide crontab and that is why the file of the crontab is called “root” under directory “/var/spool/cron/”.

Also when I run
ls -al
on my SuiteCRM directory I can see either “www” or “nginx” -:). and there is a line:

-rwxrwxrwx 1 nginx nginx 69690 May 2 19:34 suitecrm.log

So “nginx” must be the user, right?

I have added the following line into the file “root” under /var/spool/cron/ and is now seeing what will happen.

I shall keep you posted.

Thanks very very much for your kind help.

Hi,

I added the following line into the system wide crontab file “root” under “/var/spool/cron/”

          • nginx cd /a/domains/crm.softpowerworks.com/public_html; php -f cron.php > /dev/null 2>&1

and I set up a simple workflow like this:

When Opportunity create date equals “now-2 minutes” then send out an email with pre-defined template. But when I created an Opportunity record and after 2 minutes nothing happened.

I am sure in the Scheduler “PROCESS WORKFLOW TASKS” is active and works “forever” on “every minute.”

So what is wrong?

I got really confused now.

Please help. thanks.

See “How can I make sure the jobs are actually running?”, the last section in my article.

You need to make sure the jobs are even starting before trying to get a Workflow to run. On the Admin/Schedulers screen you can also check the results of individual jobs (success/failure).

to test it I suggest that you put:

date created <= now
or
now >= date created

(instead of date created = now - 2 minutes)

I really wish that I could upload any screen photos here for your reference and I believe that can make things much much easier for you to help me.

I have checked the scheduler and open an item “PROCESS WORKFLOW TASKS” and found the following:

Job Name: Process Workflow Tasks Status: Active
Date & Time Start: 01/02/2015 03:45 Active From: Always
Date & Time End: Active To: Always
Last Successful Run: Never Interval: As often as possible.
Execute If Missed: Job: function::processAOW_Workflow
Date Created: 04/07/2017 22:03 by Chris Date Modified: 04/07/2017 22:03 by Chris

And in the Joblog, shows “No result found”.

I believe this is the most important item in the Scheduler which affects my time-elapsed workflow. What is wrong with it?

Thanks.

It says your job never ran. I don’t think your cron setting is quite done yet.

As I wrote before, see “How can I make sure the jobs are actually running?”, the last section in my article. There are a number of procedures there. Once you are sure that the jobs are running, only then advance to Workflow experiments…

PS - you can paste screenshots to a number of online sites, like Pasteboard, Picpaste, Imagebin…

If I set time like what you said it works well, because it happens “now”.

But I want to achieve this function:

when I created a record, after certain time, for example 2 minutes later, it will send me an email.

If I can get this work, then I can set a workflow for any record: after certain time take some action such as sending a reminding email etc.

Thanks.

Thanks a lot for your patience. It becomes clearer now.

Please take minutes on the following photos for a full diagnose, thanks:

  1. result of running "ls -al " command:
    https://imagebin.ca/v/3L5lISln8Uve

  2. the result of running “crontab -l”
    https://imagebin.ca/v/3L5mODLqj3WQ

  3. the “process workflow task”:
    https://imagebin.ca/v/3L5n37BcJjbD

  4. my workflow:
    https://imagebin.ca/v/3L5njtANj1cV

can you please help to find what is wrong with these?

thanks!!!

When I use the following command:

tail -f /var/log/cron

I get the following:

May 3 09:16:01 iZ25pqi27dnZ CROND[35556]: (root) CMD (nginx cd /a/domains/lms.softpowerworks.com/public_html; php -f cron.php > /dev/null 2>&1)

Does this mean the cron job is already running?

Thanks

You’re doing things without thinking, without understanding, and without reading what we write.

You were told to insert a line into the system-wide crontab which is the file at /etc/crontab, and it has a specific syntax with an extra column for the user name.

But you went and put that line into a different crontab, at /var/spool/cron/root, which is obviously not a system-wide crontab, it’s root’s crontab (the one we DON’T want), and has a syntax that does not expect a username.

So now you have a job running as root, and it’s using a command “nginx cd /a/domain…” etc, so the username is being interpreted as the first word of the command. That can never work.

So remove those two lines (why two?) from /var/spool/cron/root, add a single line with the username to /etc/crontab (that’s a file you can edit).

And don’t touch workflows before you get this right. : - )