Guides & TutorialsTroubleshootingTroubleshooting Cron AutomationAdvanced Cron Troubleshooting - Intermittent Issues

Advanced Cron Troubleshooting - Intermittent Issues

Symptom

You may find that the cron job is not completing intermittently but does complete all of its tasks when you run it via the command line using these steps.

Cause

This type of issue may have many causes. You must perform additional investigation before you can determine next steps.

Investigation

In order to investigate this issue, we recommend logging the output of the cron.php script to a file and then examining its contents.

If you use cPanel & WHM, this includes steps within WHMCS and in cPanel.

For more information for other control panels, see your server's documentation.

To investigate this issue on a cPanel & WHM server:

1. In the WHMCS Admin Area, go to the Other tab at Configuration > System Settings > General Settings or, prior to WHMCS 8.0, Setup > General Settings.

2. Select Display Errors.

Tick the Display Errors checkbox

3. Click Save Changes.

4. In cPanel, go to Advanced >> Cron Jobs.

cPanel Cron Jobs icon

5. Click Edit for the cron job command that references the cron.php file:

Edit Cron Job

6. For Command, append the following code to the end of the line:

 -vvv >> crondebug.txt
Click to copy
Editing the Cron Command

7. Click Edit Line.

8. Wait until the Time of Day window has passed. For example, if the Time of Day setting is 1pm, wait until 2pm.

9. Open the crondebug.txt file in your account's root directory. This file contains entries from each invocation of the cron.php script.

cPanel File Manager v3

10. Review the file contents to locate the daily automation tasks. To find this, look for 24 or more tasks that queued for execution.

These will resemble the following examples:

  • An error during execution:
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      
Click to copy
  • A successful execution:
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
Click to copy

11. Use the explanations of common errors in our documentation to continue resolving the issue.

WHMCS Technical Support can help you with these errors. When you open your support ticket, make sure to include the full output in your crondebug.txt file.