System Cron

When you set up your WHMCS installation, you must set up the system cron to automate WHMCS’s many tasks. The system cron is a system daemon that executes tasks at designated times. WHMCS includes processes that must run on a periodic basis via the cron.

Cron Tasks

The method that you use to set up your cron jobs will depend on the type of server that you use and whether you prefer to use the command line or a control panel interface.

Most hosting control panels provide a simple user interface for creating cron jobs. For more information, see Configure the System Cron Job.

After you set up the cron job, you can change the time at which the daily automated actions run using Time of Day at Configuration () > System Settings > Automation Settings. You must ensure that the system cron will run during the hour that you set.

  • WHMCS uses the PHP now() timestamp when the cron.php script runs. This determines the current time using the value that the PHP configuration returns.
  • We recommend running the cron task every five minutes. WHMCS will never perform a particular task more frequently than you specify.
  • Make certain that WHMCS’s configured timezone matches the server’s timezone.
For steps to set the Time of Day setting, see Configure When Daily Tasks Run.

When you configure WHMCS, set up the following cron tasks:

System Cron

The system cron automates tasks within WHMCS. The system uses this to automate billing, generate invoices, and perform many other actions. Configure this to run every 5 minutes, or as frequently as your hosting provider allows (at minimum, once per hour).

You can find the correct command to copy-and-paste for your WHMCS installation by going to Configuration () > System Settings > Automation Settings and clicking on the first badge:

Automation Settings badges

For example: */5 * * * * php -q /home/username/crons/cron.php

For more information, see System Cron Options and Example Cron Commands (below).

POP Email Import Cron

You only need to configure this cron task if you want to import emails to the support queue via the POP3 protocol.

If you use this, configure it to run every five minutes.

For example: */5 * * * * php -q /home/username/crons/pop.php

We recommend using email piping instead.

The crons Directory

All of the files for WHMCS’s cron tasks are in the crons directory.

You can move the crons folder to any location above or below the document root. We recommend moving it to a private directory above your document root for better security.

For more information, see Moving the Crons Directory.

System Cron Options

The system cron automates tasks within WHMCS. You can run the system cron script (crons/cron.php) with additional options if you need additional control over the tasks that run and the script’s output.

The system cron script has the following argument input structure:

cron.php [<argument> [options]]

  • Most WHMCS installations will not need these additional options.
  • To pass arguments to PHP scripts, you must enable the register_argc_argv directive. For help, contact your hosting provider or system administrator.
You can also use the hook system to customize what happens before, during, and after the system cron runs. For more information, see our Developer Documentation.

Arguments

You can use the following arguments:

ArgumentDescriptionExample
allAttempt to perform all due automation tasks. If you do not provide input, the cron runs with this argument by default.*/5 * * * * php -q /path/to/cron.php all
doOnly perform the tasks that you specify.
  • The --force option is enabled by default when you use this argument.
  • The system does not modify its internal scheduling for tasks when you run tasks using this argument.
For a list of tasks, see Tasks below.
helpLists help and options for the argument you specify.
listLists all possible arguments.
skipPerform all tasks (in the same way as the all argument) but exclude tasks that you specify.
For a list of tasks, see Tasks below.
*/5 * * * * php -q /path/to/cron.php skip --DomainRenewalNotices
You can view the additional options for each of the above options using help <argument>.

Options

You can use the following arguments:

OptionDescription
-F, --forceForce the execution of tasks, regardless of whether the task is due or already in progress.
-v, -vv, -vvvSet the verbosity of command line output. By default, the system cron does not generate any success output.
--email-reportForcibly send a digest report of the actions during the run. This report contains information about that cron run and will not contain information from previous runs. During the normal daily run, this uses a default value of 1 and sends the Digest Email Report message. In all other runs, this defaults to 0 and does not send anything. For example: --email-report=1
-V, --versionOutput the WHMCS version and exit.
--no-ansiStrip any non-printing command line markup (for color output).
-h, --helpPrint help for a command. This returns the same output as the help argument.

Tasks

Most of the system cron’s tasks only need to run daily. Others, however, may benefit from running multiple times per day, like ticket escalations or checking for WHMCS updates. A few tasks only run once per month, like calculating overage usage and generating invoices.

  • WHMCS handles running cron tasks correctly automatically for scheduled cron runs, but you can also choose tasks to run (using the do argument) or skip (using the skip argument) when running the cron yourself.
  • The system cron also runs specific system tasks after it completes the tasks below. You cannot specify these tasks when running the cron command yourself.
  • For an example of scheduling a particular task to only execute on a particular schedule, see Custom Task Runs below.

The system runs the cron tasks in the following order:

OptionDescriptionIn VersionFrequency
--CurrencyUpdateExchangeRatesUpdate currency exchange rates.WHMCS 8+Daily
--CurrencyUpdateProductPricingUpdate product prices for current currency exchange rates.WHMCS 8+Daily
--TenantUsageMetricsUpdate the usage data that displays when you view services in the Products/Services tab in the client profile.WHMCS 8+Twice Daily
--CreateInvoicesGenerate invoices.WHMCS 8+Daily
--AddLateFeesApply late fees to unpaid invoices that are past their due dates.WHMCS 8+Daily
--ProcessCreditCardPaymentsProcess credit card charges.WHMCS 8+Daily
--InvoiceRemindersGenerate reminders for unpaid and overdue invoices.WHMCS 8+Daily
--DomainRenewalNoticesSend domain renewal notices.WHMCS 8+Daily
--CancellationRequestsCancel services with cancellation requests (including requests for services with Auto Terminate End of Cycle enabled.WHMCS 8+Daily
--AutoSuspensionsSuspend services that are due for suspension.WHMCS 8+Daily
--AutoTerminationsTerminate services that are due for termination.WHMCS 8+Daily
--FixedTermTerminationsProcess fixed-term terminations.WHMCS 8+Daily
--InvoiceAutoCancellationAutomatically cancel old overdue unpaid invoices.WHMCS 8.10+Daily
--CloseInactiveTicketsClose inactive support tickets.WHMCS 8+Daily
--AutoPruneTicketAttachmentsRemove attachments for inactive tickets. This task runs in batches of 1,000.WHMCS 8+Hourly
--AffiliateCommissionsProcess payment of delayed affiliate commissions.WHMCS 8+Daily
--AffiliateReportsSend monthly affiliate report emails.WHMCS 8+Monthly
--EmailCampaignsUpdate the statuses of email campaigns and schedule emails. This task runs in batches of 50.WHMCS 8+As soon as every five minutes.
--ProcessEmailQueueSend scheduled emails for your email campaigns. This task runs in batches of 25.WHMCS 8+As soon as every five minutes.
--EmailMarketerProcess Email Marketer rules.WHMCS 8+Daily
--SslStatusSyncCheck SSL certificate validity for services and domains. This task runs in batches of 100.WHMCS 8+Daily
--CreditCardExpiryNoticesSend expiry reminders for client credit cards.WHMCS 8+Monthly
--UpdateServerUsageUpdate disk and bandwidth usage statistics.WHMCS 8+Daily
--OverageBillingProcess overage billing charges and generate related invoices.WHMCS 8+Monthly
--AutoClientStatusSyncSync client statuses.WHMCS 8+Daily
--UpdateDomainExpiryStatusUpdate the expiry status for domains with a past expiry date.WHMCS 8+Daily
--TicketScheduledActionsAttempt any scheduled actions at their scheduled execution time.WHMCS 8.12+As soon as every one minute.
--TicketEscalationsProcess and escalate tickets according to your configured escalation rules.WHMCS 8+As soon as every three minutes.
--DataRetentionPruningAutomatically delete clients with the Inactive and Closed statuses.WHMCS 8+Daily
--SslReissuesProcess MarketConnect SSL certificate reissuances.WHMCS 8.5+Daily
--ServerUsageCountAutomatically update the server usage count that displays at Configuration () > System Settings > Servers.WHMCS 8+Hourly
--ServerRemoteMetaDataAutomatically update the server metadata that displays at Configuration () > System Settings > Servers.WHMCS 8+Hourly
--RunJobsQueueRun any queued jobs.WHMCS 8+As soon as every five minutes.
--CheckForWhmcsUpdateCheck for WHMCS version updates.WHMCS 8+As soon as every 8 hours
--DomainTransferSyncSync domain transfers for domains in the Pending Transfer status.WHMCS 8+As soon as every hour.
--DomainStatusSyncSync domain statuses for domains in the Active status. This task runs in batches of 50.WHMCS 8+As soon as every hour.
--DatabaseBackupCreate database backups according to your settings at Configuration () > System Settings > Database Backups.WHMCS 8+Daily

Custom Task Runs

If you want a particular task to only execute on a particular schedule, create a separate scheduled cron command that uses the do argument for that task and alter your main System Cron command to skip that task using the skip argument.

For example, you could schedule the first cron command below to skip ticket escalations and automatic suspensions on regular runs:

*/5 * * * * php -q /path/to/cron.php skip --TicketEscalations --AutoSuspensions

Then, you could schedule the second and third commands separately to only process ticket escalations on weekdays during business hours and only process automatic suspensions on weekday mornings:

0 9,10,11,12,13,14,15,16 * * 1-5 php -q /path/to/cron.php do --TicketEscalations
0 9 * * 1-5 php -q /path/to/cron.php do --AutoSuspensions

Invoke the Cron with an HTTP Request

In some hosting environments, you may not be able to create a crontab entry directly. Instead, you can invoke the cron command using an HTTP request.

To do this, ensure that the cron.php script is accessible within the document root.

For example, the following GET request runs the system cron, skipping the DomainRenewalNotices and TicketEscalations tasks.

GET http://www.example.com/admin/cron.php?command=skip&options=DomainRenewalNotices,TicketEscalations

Last modified: January 21, 2025