SuiteCRM Cronjob setup on Webhost

I am attempting to setup on our webhost as we have a number of different applications already setup and our host allows databases and subdomains etc. I managed to get about 98% of the install and setup all working, including changing layouts, adding fields and importing all my data - I just ran into an issue with Workflows and automating tasks.

It has an instruction on the bottom of the Schedulers section that reads (note I was not sure if it was a good idea for full data directories to be posted so I crossed some info out)

In order to run SuiteCRM Schedulers, edit your web server user’s crontab file with this command:
sudo crontab -e -u ----------------
… and add the following line to the crontab file:

*    *    *    *    *     cd /home/--------------/domains/----------------/public_html/marketing; php -f cron.php > /dev/null 2>&1 

However, the webhost has an advanced section with a place for me to “add cron jobs” that looks like this:

I spent a good hour on the chat today with their support person trying to add this in, nothing is working. They suggested I reach out to support here to ask as they cannot get it to work.

Can anyone here offer some advice on this setup? Or is it something not possible in this kind of web hosted environment?

Hi and welcome!
Does your webhost allow you to update your crontab directly via CLI (usually they dont if they offer such an interface like in your screenshot).
But: the URL looks strange, I would suspect something like .../public_html/suite/cron.php or ...public_html/cron.php, but wp-cron.php is definitely not correct.

For the fields minutes, hours, days, months, weekdays you should be able to select something like * (equals “as often as possible”).

Last but not least: I assume the user executing the cron.php might be the wrong one. Pls try to setup the cron first and have a look if it works, if not: see the suitecrm.log file and look for a message like “cron cannot be triggered by this user”). If that’s the case, you can add the missing user in your config.php.

Thanks for that. I actually spent a lot of time with their support before ultimately switching to a VPS solution so I had more control and not so many issues setting up the cron jobs.

So today, I have spent most of the day transferring the website and getting ready for setup and I had roughly the same two commands to be added, which I logged in via putty to the server and completed both. If I open the cron file in var/log I can see the command being run every minute:

Mar 25 06:18:01 ************ CROND[6661]: (login5785) CMD (cd /home/************/public_html/marketing; php -f cron.php > /dev/null 2>&1)
Mar 25 06:19:01 ************CROND[6696]: (login5785) CMD (cd /home/************/public_html/marketing; php -f cron.php > /dev/null 2>&1)
Mar 25 06:20:01 ************CROND[6732]: (login5785) CMD (cd /home/************/public_html/marketing; php -f cron.php > /dev/null 2>&1)
Mar 25 06:21:01 ************CROND[6763]: (root) CMD (if ! find /home/*/public_html/ -maxdepth 2 -type f -newer /usr/local/lsws/cgid -name '.htaccess' -exec false {} +; then /usr/local/lsws/bi
n/lswsctrl restart; fi)
Mar 25 06:21:01 ************CROND[6764]: (login5785) CMD (cd /home/************/public_html/marketing; php -f cron.php > /dev/null 2>&1)
Mar 25 06:22:01 ************CROND[6804]: (login5785) CMD (cd /home/************/public_html/marketing; php -f cron.php > /dev/null 2>&1)
Mar 25 06:23:01 ************CROND[6835]: (login5785) CMD (cd /home/************/public_html/marketing; php -f cron.php > /dev/null 2>&1)
Mar 25 06:24:01 ************CROND[6890]: (root) CMD (if ! find /home/*/public_html/ -maxdepth 2 -type f -newer /usr/local/lsws/cgid -name '.htaccess' -exec false {} +; then /usr/local/lsws/bi
n/lswsctrl restart; fi)

So I am “assuming” it is setup and running - except none of the scheduled tasks are actually running. That is, they show as never run and my test schedule doesn’t work.

Is there a different place I can look at logs to see what is happening? I see no errors here but this may be the wrong place and I will admit I am not an expert here on a VPS and I am learning putty as I go.

Scratch that, I made progress.

I found the suitecrm log file and it is showing the error that is clearly causing the problem:

Thu Mar 25 06:38:01 2021 [7325][-none-][FATAL] cron.php: running as login5785 is not allowed in allowed_cron_users in config.php. Exiting.
Thu Mar 25 06:39:01 2021 [7353][-none-][FATAL] cron.php: running as login5785 is not allowed in allowed_cron_users in config.php. Exiting.
Thu Mar 25 06:40:02 2021 [7384][-none-][FATAL] cron.php: running as login5785 is not allowed in allowed_cron_users in config.php. Exiting.
Thu Mar 25 06:41:01 2021 [7416][-none-][FATAL] cron.php: running as login5785 is not allowed in allowed_cron_users in config.php. Exiting.
Thu Mar 25 06:42:01 2021 [7444][-none-][FATAL] cron.php: running as login5785 is not allowed in allowed_cron_users in config.php. Exiting.
Thu Mar 25 06:43:01 2021 [7483][-none-][FATAL] cron.php: running as login5785 is not allowed in allowed_cron_users in config.php. Exiting.

My only thing I am slightly confused on is that the “login5785” is the command SuitCRM told me to implement - do I change that to “admin”? Or do I need to add this “login5785” somewhere?

Ok, I have fixed it (thank god).

I did the last error to myself it seems. In transferring the website, the config.php file had the old user in the allowed user lists, which has now changed with the transfer, so updating and testing it is functioning.

Thanks for assiting and leaving this here in case anyone happens to come across any similar issues ^

1 Like