Another Schedulers aren't working post

Anyone want to play the “Schedulers aren’t working” game? XD

Would really appreciate any pointers!

Details below:

Cron job added to CPanel as instructed:
* * * * * cd /home/!USER!/public_html; php -f cron.php > /dev/null 2>&1

Performed Admin - Rebuild Schedulers
Performed Quick repair and rebuild

Folder permissions
775: cache custom modules themes data upload config_override.php
755: everything else

Schedulers all say never successfully run.

Technical info:

SuiteCRM 7.11.18
Platform CentOS 7.9 (WHM & CPanel v92.0.9)
PHP 7.3
Web Server Apache 2.4.46
Database MySQL 5.7.33

Hey,

Do you see anything in either of the error logs, when the schedulers are supposed to have run?
(ie: suitecrm.log or the PHP error log?)

I haven’t used cPanel myself, so I’m not sure how much help I’ll be, but i’ve seen a few threads around it with varying levels of success, hopefully one of these has a solution?:

(or, at least, things to investigate that can give more info)





Some common suggestions seem to be:

  • Specify a full path to cron.php or the php executable in the cron job
    ie:
cd [suiteCRM location]; [php executable location]php -f cron.php > /dev/null 2>&1 

(ie, in the 4th link above, a user noted they had to do this with cron.php)


Another thing to check is what web-server user Cron is running under.
There is a section in the config.php file, wherein you can specify web-server users that Cron is allowed to run on:
ie:

 'allowed_cron_users' =>
	 array (
		0 => 'www-data',
	 ),

If Cron is running under a user that is not in this Array, it may be worth adding them


Let us know how you get on, hopefully something above can assist!

1 Like

Don’t forget this link

Hi @pgr - thanks for your input.

I’ve followed some of the advice laid out above.

In config.php under allowed users we have both our username and www-data for good measure.

array (
0 => ‘!USER!’,
1 => ‘www-data’,
),

As for Cron Jobs I’ve set up a few to see if anything changes.

***** cd /home/!USER!/public_html; php -f cron.php > /dev/null 2>&1
***** cd /home/!USER!/public_html; php-cli -f cron.php > .dev/null &2>1
***** /usr/local/php73/bin/php-cli -f /home/!USER!/public_html/cron.php > /dev/null 2>&1
***** cd /home/!USER!/public_html; /usr/bin/php -f /home/!USER!/public_html/cron.php > /dev/null 2>&1

The only difference made is that I now receive an email every minute from the Cron Daemon saying:

"/usr/local/cpanel/bin/jailshell: .dev/null: No such file or directory"

This is since I added the php.cli cron job.

The only Cron related error I can find in error_log reads:

[25-Feb-2021 03:48:10 UTC] PHP Fatal error:  Uncaught Exception: cron.php is CLI only. in /home/!USER!/public_html/include/utils.php:1898
Stack trace:
#0 /home/!USER!/public_html/cron.php(52): sugar_die('cron.php is CLI...')
#1 {main}
  thrown in /home/!USER!/public_html/include/utils.php on line 1898

I can’t see any Cron or Scheduler related errors in Admin>System Settings>Log - this is with log level set to error.

The error message is telling you that one of your cron commands (it’s the second one) says .dev/null where it should say /dev/null

Gotcha thanks

I’ve fixed that and now it’s telling me:
usr/local/cpanel/bin/jailshell: php-cli: command not found

Some of your commands use a full path to php-cli, others don’t. Check what the actual full path is, and add it to all commands.

For example,

/usr/local/php73/bin/php-cli

or

/usr/bin/php-cli

or simply

/usr/bin/php

I’m struggling to find out what the actual full path is - using cpanel’s search there is no php-cli anywhere in public_html.

There are only these results - are these relevant?
:file_folder: /.cpanel/ea-php-cli
🗎/.cpanel/ea-php-cli/.ea-php-cli.cache
🗎/.cpanel/ea-php-cli/public_html/.ea-php-cli.cache
🗎/.cpanel/ea-php-cli/public_html/new/.ea-php-cli.cache
🗎/.cpanel/ea-php-cli/public_html/main/.ea-php-cli.cache

Ideally I’d like to just have one command running

These are my cron daemon messages when I just run one:

command cron daemon message
cd /home/!USER!/public_html; php -f cron.php

**(this is what suitecrm suggests)**
PHP Warning: PHP Startup: Unable to load dynamic library 'php_fileinfo.dll' (tried: /opt/cpanel/ea-php73/root/usr/lib64/php/modules/php_fileinfo.dll (/opt/cpanel/ea-php73/root/usr/lib64/php/modules/php_fileinfo.dll: cannot open shared object file: No such file or directory), /opt/cpanel/ea-php73/root/usr/lib64/php/modules/php_fileinfo.dll.so (/opt/cpanel/ea-php73/root/usr/lib64/php/modules/php_fileinfo.dll.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
cron.php is CLI only.
cd /home/!USER!/public_html; /usr/bin/php -f /home/!USER!/public_html/cron.php PHP Warning: PHP Startup: Unable to load dynamic library 'php_fileinfo.dll' (tried: /opt/cpanel/ea-php73/root/usr/lib64/php/modules/php_fileinfo.dll (/opt/cpanel/ea-php73/root/usr/lib64/php/modules/php_fileinfo.dll: cannot open shared object file: No such file or directory), /opt/cpanel/ea-php73/root/usr/lib64/php/modules/php_fileinfo.dll.so (/opt/cpanel/ea-php73/root/usr/lib64/php/modules/php_fileinfo.dll.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
cron.php is CLI only.
cd /home/!USER!/public_html; php-cli -f cron.php /bin/bash: php-cli: command not found
/usr/local/bin/ea-php73 /home/!USER!/public_html; php-cli -f cron.php /bin/bash: php-cli: command not found
php-cli /home/!USER!/public_html/cron.php /bin/bash: php-cli: command not found
php /home/!USER!/public_html/cron.ph X-Powered-By: PHP/7.3.27 Content-type: text/html; charset=UTF-8

cron.php is CLI only.

Do you have access to a console?

Just type

which php
or
locate php

Don’t bother with php-cli if you don’t have any reason for it. If you call php from command-line then it’s the CLI version that gets called.

Another way to find out is just Google for “PHP path in Ubuntu 20.04” or whatever your OS is.

This gave me /usr/local/bin/php

So the command is now:
/usr/local/bin/php /home/!USER!/public_html/cron.php

I’m now no longer getting those mailer daemon emails - and I can see that some schedulers are attempting.

For instance I’m now seeing Cron related Fatal errors in the system log:
(Run Report Generation Scheduled Tasks) failed in CRON run
(Process Workflow Tasks) failed in CRON run

Thanks for helping me get the command right!

You forgot the -f

@pgr thanks again.

The good news is it seems the run nightly email scheduler is working!

Apologies, is this the correct place to be placing -f? I don’t know what it’s meant to be doing.

-f : Used to stay in foreground mode, and don’t daemonize.

Would this be the correct placement?

/usr/local/bin/php -f /home/!USER!/public_html/cron.php

So in your case, something like:

*  *    * * *  cd /home/!USER!/public_html/; /usr/local/bin/php -f cron.php > /dev/null 2>&1

If you change the directory with cd then you don’t need to put it in again beofre the cron.php part.

Make sure that is not the root crontab - it should be the crontab of the user that your web server is running under.

1 Like