Difference between revisions of "Cron Configuration"
(Added details of where to find cron command in v8) |
|||
Line 8: | Line 8: | ||
==Setting Up Cron Jobs== | ==Setting Up Cron Jobs== | ||
− | |||
The tutorials & screenshots below demonstrate how to configure the WHMCS cron on the most common hosting control panels. | The tutorials & screenshots below demonstrate how to configure the WHMCS cron on the most common hosting control panels. | ||
− | + | The system will attempt to determine the PHP path to use for your cron command. Prior to WHMCS 8.0, this can be seen at '''Setup > Automation Settings'''. For WHMCS 8.0 and above, please visit '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > Automation Settings''' and click on the first badge. | |
− | + | [[File:Cron-configuration-badge.png|border]] | |
===cPanel=== | ===cPanel=== | ||
Line 19: | Line 18: | ||
<html><a href="https://www.youtube.com/watch?v=caZWco1R2kk&hd=1" class="docs-video-tutorial"><em>Watch the video tutorial for this feature</em><span> <img src="https://assets.whmcs.com/icons/youtube.png"> </span></a></html> | <html><a href="https://www.youtube.com/watch?v=caZWco1R2kk&hd=1" class="docs-video-tutorial"><em>Watch the video tutorial for this feature</em><span> <img src="https://assets.whmcs.com/icons/youtube.png"> </span></a></html> | ||
− | Click on the '''Cron Job''' icon in cPanel, select the ''Once | + | Click on the '''Cron Job''' icon in cPanel, select the ''Once Per Five Minutes'' option from the Common Settings dropdown menu. Then paste the cron command into the Command field. |
[[File:cPCron.png|border]] | [[File:cPCron.png|border]] |
Revision as of 10:05, 10 February 2021
Cron tasks must be created to automate tasks within WHMCS.
Cron is the name given to a system daemon used to execute tasks (in the background) at designated times. WHMCS has a number of files that are required to be run on a periodic basis in this way. All these files are located in the crons directory.
A single cron named the System Cron automates all core functions of the system including invoicing, reminders, suspensions and other daily automation tasks.
In WHMCS 6.3.x and earlier, the system cron should be configured to run no more than once per day. In WHMCS 7.0 and later, the system cron should be configured to run every 5 minutes, or as frequently as your web hosting provider will allow.
Contents
Setting Up Cron Jobs
The tutorials & screenshots below demonstrate how to configure the WHMCS cron on the most common hosting control panels.
The system will attempt to determine the PHP path to use for your cron command. Prior to WHMCS 8.0, this can be seen at Setup > Automation Settings. For WHMCS 8.0 and above, please visit Configuration () > System Settings > Automation Settings and click on the first badge.
cPanel
Watch the video tutorial for this feature
Click on the Cron Job icon in cPanel, select the Once Per Five Minutes 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:
Option | Minute | Hour | Day | Month | Weekday | Command | ||
---|---|---|---|---|---|---|---|---|
a) | */5 | * | * | * | * | php -q /path/to/home/public_html/whmcspath/crons/cron.php | ||
b) | */5 | * | * | * | * | wget -O http://www.yourdomain.com/whmcspath/crons/cron.php >/dev/null | ||
c) | */5 | * | * | * | * | GET http://www.yourdomain.com/whmcspath/crons/cron.php |
Direct Admin
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:
Command |
---|
/usr/bin/php -q /home/demo_user/domains/testdomain.com/public_html/whmcspath/crons/cron.php |
/usr/local/bin/php -q /home/demo_user/domains/testdomain.com/public_html/whmcspath/crons/cron.php |
wget -O /dev/null http://domain.tld/path/to/cron.php |
GET http://www.yourdomain.com/whmcspath/crons/cron.php |
DotNetPanel
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.
Windows Server
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:
Command |
---|
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.
Plesk
Navigate to the Domain where WHMCS is hosted, and click on the Schedule Tasks option in the top-right menu.
From the Schedule Tasks page, perform the following actions:
- Click on the Add Task button
- Set "Task type" to the "Run PHP script" option
- Input the path to your cron.php script into the "Script path" field
- Select PHP 5.6 or later for the "Use PHP version" option
- Select the "Cron style" option from the "Run" drop-down menu
- Input "*/5 * * * *" into the "Cron style" field
- Click on the "OK" button
Example "Script path" for Linux |
---|
/path/to/whmcs/crons/cron.php |
Example "Script path" for Windows |
---|
/path/to/whmcs/crons/cron.php |