The WHMCS cron job is the process that performs all the automated actions.
Just 1 single cron job needs to be setup to automate all the core functions of the system (invoicing, reminders, suspensions, etc...)
The cron must be configured to run no more than once per day.
Setting Up Cron Jobs
The tutorials & screenshots below demonstrate how to configure the WHMCS cron on the most common hosting control panels.
You can obtain the exact cron command you need to use for your installation from Setup > Automation Settings at any time.
The examples below will setup the cron to run at 9am every day.
Click on the Cron Job icon in cPanel, select the Once A Day option from the Common Settings dropdown menu. Then paste the cron command into the Command field.
Alternatively click the Advanced (Unix Style) button and use the following:
|a)||0||9||*||*||*||php -q /path/to/home/public_html/whmcspath/adminpath/cron.php|
|b)||0||9||*||*||*||wget -O http://www.yourdomain.com/whmcspath/adminpath/cron.php >/dev/null|
The command for Direct Admin is generally the same as cPanel, however, you need to reference the full path to the php binary.
This can be /usr/bin/php, /usr/bin/home/php or /usr/local/bin/php but this is dependent on the server setup and you should check with your Server Administrator for the full path to the php binary.
An example command to run is:
|/usr/bin/php -q /home/demo_user/domains/testdomain.com/public_html/whmcspath/admin/cron.php|
|/usr/local/bin/php -q /home/demo_user/domains/testdomain.com/public_html/whmcspath/admin/cron.php|
|wget -O /dev/null http://domain.tld/path/to/cron.php|
Navigate to the hosting space in which WHMCS is installed and click Scheduled Tasks from the Hosting Space Menu, then click Add Scheduled Task.
From the Task Type dropdown menu select the Check Web Site Availability option and enter the URL of the cron.php file into the URL field. Use the Schedule options to run this task Daily and finally ensure it's active and running.
Depending on your server setup, you can run the cron directly from the php executable. If this is not possible, you would need to use the server browser to run the cron
An example command to run is:
|C:\php\php.exe -q "C:\inetpub\wwwroot\whmcs7\admin\cron.php"|
|"c:\program files\internet explorer\iexplore.php" "http://www.yourdomain.com/whmcspath/cron.php"|
You should then set the task to run at a certain time every day. The time is up to you.
You can specify the php command using the following on Linux Plesk:
env php -q /home/user/whmcs/admin/cron.php
The Windows version of Plesk is slightly different. You need to specify the path to the php executable and then specify the path to your cron.php file.
Check the appropriate boxes to run at the time you wish and press ok to save.
Passing in option flags to the cron process allows you to customise the actions that get performed. By default, all actions will run but you can pass in any of the flags below to skip or only do certain processes.
- affcommissions - Calculate affiliate commissions
- affreports - Send affiliate reports on the first day of the month only
- backups - Generate WHMCS database backup
- cancelrequests - Process cancellation requests
- ccexpirynotices - Send credit card expiration notices
- ccprocessing - Process credit card payments
- clientstatussync - Change client statuses (Active, Inactive, Closed)
- closetickets - Auto-close answered tickets
- domainrenewalnotices - Send upcoming domain renewal notice emails
- emailmarketing - Send email marketer emails
- fixedtermterminations - Terminate fixed-term products due today
- invoicereminders - Send invoice payment reminder emails
- invoices - Generate due invoices
- latefees - Apply late fees to overdue invoices
- overagesbilling - Generate overage invoices on the last day of the month only
- suspensions - Suspend overdue accounts
- terminations - Terminate overdue accounts
- updatepricing - Update product prices based upon the currency base conversion rates
- updaterates - Update currency base conversion rates
- usagestats - Update usage statistics from the server
- skip_report - Do not send the WHMCS Cron Job Activity email
How to use Option Flags
Flags are passed in by simply appending them to the cron command. All the flags can be preceded with do_ or skip_. When running with do_, the cron will only complete the actions listed, everything else will be skipped. When using skip_, WHMCS will run all other commands except those specified to be skipped.
Skipping or doing functions will not stop the cron job hooks from running. These will run any time the cron.php file is accessed, irrespective of the number of actions to be completed.
Option flags should be specified after the cron path. For example, to skip credit card processing, you would configure the cron command as follows:
php -q /path/to/cron.php skip_ccprocessing
To perform automatic ticket closure and usage status updating, you would configure the cron command as follows:
php -q /path/to/cron.php do_closetickets do_usagestats
Or alternatively as a browser request, like this:
You can specify as many option flags in a single cron command as you require.