Troubleshooting Cron and Schedulers
Scheduler Not Running Automatically
If your scheduler job fails to run automatically but may be run manually, navigate to Admin > Scheduler and check if the log for your scheduled job lists any entries. If there are no entries, then check the logs of other scheduled jobs for entries. If those job logs contain entries, then use the Repair option to rebuild the scheduler (Admin > Repair >Rebuild Scheduler).
For even more control over your schedulers, please refer to the Advanced Configuration Options documentation.
Note: If you have customized the default schedulers any they will be reset to default after running the Rebuild Schedulers. Please note any custom schedules and active/inactive statuses on the Schedulers before executing.
If the problem is not resolved please try the following troubleshooting tips in the environment your server is running on:
Troubleshooting on Unix/Linux
If the Sugar Scheduler fails to run even though the cron.log file shows that the crontab is triggering the new job, one of the following scenarios may be occurring:
- The Apache user's PATH does not include the location of the PHP binary.
- Change the crontab entry to include the FULL path to the PHP binary as shown below:
* * * * * /usr/local/bin/php -f cron.php > /dev/null 2>&1
- Change the crontab entry to include the FULL path to the PHP binary as shown below:
- The Apache user's PATH does not include the location of the php.ini file, and thus the external libraries (such as mod_mysql and mod_imap) are unavailable at run time.
- Change the crontab entry to include a PHP switch to explicitly define a php.ini to use as shown below:
* * * * * php -c /path/to/php.ini -f cron.php > /dev/null 2>&1"
- Change the crontab entry to include a PHP switch to explicitly define a php.ini to use as shown below:
Troubleshooting on Windows
The most common problem is that the PHP binary does not have the proper libraries available at run time. As a result, it cannot make calls to your database or to your Email server. To force PHP to be aware of these libraries, it needs to access the php.ini file, which in turn tells it where to find everything that is available.
Locate the php.ini file: if you are unsure, run the following command:
phpinfo();
The system identifies the php.ini file and its location.
Another common breakage is incorrect paths to the extensions that PHP needs; a map is useless if the information is bad. Follow the steps listed below to fix this problem:
- Open php.ini in any text editor.
- Find the section named Paths and Directories.
- The relevant entry is extension_dir.
- Double-check the paths listed, Keeping in mind that extension_dir piggybacks on Window's $PATH$ variable.
- Correct any errors - sometimes giving an absolute path solves hard-to-diagnose problems, for example, full path listing from c:\... onwards.
Necessary extensions are disabled. - Open your php.ini file in a text editor.
- Find the section named Dynamic Extensions.
- Scroll down to the Windows-specific list.
- Make sure that the necessary extensions are uncommented (no ";" preceding the line). The bare minimum for Sugar Scheduler to run is to have php_curl, your database Connector, typically php_mysql, and php_imap.
- Retest the batch file.