Intermittent Cron Failures

Problem

The cron successfully finishes all of its tasks when you run it manually, but some cron job runs still do not succeed.

Cause

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

Troubleshooting

To troubleshoot this, log the output of the cron.php script to a file and then examine its contents.

The steps below do this on a cPanel & WHM server. For more information for other control panels, see your server’s documentation.

To investigate this issue on a cPanel & WHM server:

  1. Enable Display Errors in the Other tab at Configuration () > System Settings > General Settings.

    For more information, see Enable Error Reporting.

  2. In cPanel, go to Advanced » Cron Jobs.

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

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

    -vvv >> crondebug.txt
    
  5. Click Edit Line.

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

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

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

    An error occurring 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      
    

    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
    
  9. Use the error that you find to determine the issue’s cause.

  • For more information, search for the specific error in our Troubleshooting documentation.
  • For additional help, contact WHMCS Technical Support. Include the full output from the steps above when you open your ticket.

Last modified: June 14, 2024