Guides & TutorialsCron & Automation TroubleshootingAdvanced Cron Troubleshooting - Intermittent Issues

Advanced Cron Troubleshooting - Intermittent Issues

If you have determined that the cron job is not completing intermittently, but does complete all tasks when invoked via the command line in the previous article, this guide shows how to identify the cause.

We will see how to log the output from the cron.php script to a file using cPanel. Your server may have a different interface for managing cron jobs, or the edit can often be made via the command line. Please refer to your server documentation for more information.

 

1. Access your WHMCS Admin area. Then, go to Configuration > System Settings > General Settings > Other, or Setup > General Settings > Other for WHMCS 7.10 and earlier.

2. Check Display Errors and then click Save Changes.

Tick the Display Errors checkbox

3. Log in to the cPanel account that hosts your WHMCS installation

4. Click on Cron Jobs.

cPanel Cron Jobs icon

5. Edit the cron job command which references the cron.php file:

6. In the Command field, append the following code at the end:

 -vvv >> crondebug.txt
Editing the Cron Command

7. Click Edit Line

8. Wait until the Time of Day window has passed.

Eg. If the Time of Day setting is 1pm, wait until 2pm.

9. Open the crondebug.txt file which was created in your account root:

cPanel File Manager v3

10. The file will contain a number of entries from invocation of the cron.php script. Review the file contents to locate the daily automation tasks run. This can be identified by the 24+ tasks queued for execution.

  • An error during the execution could look something like this:
WHMCS Automation Task Utility: all
==================================

Queuing Tasks
-------------

 Applying "in progress" and "is due" state filters
 Task queues ready

Executing Application Queue
---------------------------

 
 Currency Exchange Rates
 
 Product Pricing Updates
 
 Tenant Usage Metrics

 [ERROR] WHMCS\Exception\Module\NotServicable: Connection Error: Could not resolve host: fakeservertest(6) in           
         /home/v80whmcssupport/public_html/whmcs/modules/servers/cpanel/cpanel.php:0      
  • A successful execution looks like this:
WHMCS Automation Task Utility: all
==================================

 Daily Cron Automation Mode

Queuing Tasks
-------------

 Applying "in progress" and "is due" state filters
 Task queues ready

Executing Application Queue
---------------------------

 
 Currency Exchange Rates
 
 Product Pricing Updates
 
 Invoices
 
 Late Fees
 
 Credit Card Charges
 
 Invoice & Overdue Reminders
 
 Domain Renewal Notices
 
 Cancellation Requests
 
 Overdue Suspensions
 
 Overdue Terminations
 
 Fixed Term Terminations
 
 Inactive Tickets
 
 Delayed Affiliate Commissions
 
 Email Marketer Rules
 
 SSL Sync
 
 Server Usage Stats
 
 Client Status Update
 
 Domain Expiry
 
 Ticket Escalation Rules
 
 Data Retention Pruning
 
 WHMCS Updates
 
 Run Jobs Queue



 Sending Daily Cron Digest email

Executing System Queue
----------------------



 [OK] Completed

These errors can be used to identify the cause of the cron not completing.

Explanations of common errors are available in our documentation.

WHMCS technical support can advise on the solution to errors which you may encounter, please include the full output when opening a support ticket.