How to create Scheduled Tasks (Cron Jobs) in cPanel?
Hashtags: #cPanel
Last updated
Hashtags: #cPanel
Last updated
To create a scheduled task, access your control panel and then, in the Advanced section, go to Cron Jobs.
The Cron Jobs screen has several sections. First, it will ask you for an optional email address where you want to receive the execution report of the scheduled task. If you do not configure an email address, the server will send the report to the default email address generated by cPanel.
If you want to learn more about the default email address created by cPanel, you can access this link: Catch All Mailbox.
In the second section, you will see sample information to create the command of the task that will be executed. It is very important to pay attention to these examples. Let's go over each point:
The example indicates that, according to your PHP version, you should write the command /usr/local/bin/ea-php99
according to the PHP version number you have. If your account uses PHP 8.0, you should write: /usr/local/bin/ea-php80
You can find out which PHP version your account is using by accessing MultiPHP Manager in the control panel.
In this section, you must define how often your scheduled task will run. You can complete this by selecting options from each dropdown menu.
Finally, you will see the box where you should write the command to execute the scheduled task. This is where you should write the command /usr/local/bin/ea-php
mentioned in point 1.
An example would be: /usr/local/bin/ea-php80 /home/mycPanelUser/public_html/myscript.php
The last section of Cron Jobs will display all the scheduled tasks you have created. You can edit or delete a task that has already been created.