Set up a CRON job in cPanel

  Print

Set up a CRON job in cPanel

Note: Our support team can assist with ensuring the CRON jobs are run by the server at the appropriate time, but cannot advise on the commands themselves. If you require assistance with creating a CRON to perform a specific task, we'd recommend getting in touch with a developer.


Step 1 - Log into cPanel and click the Cron Jobs icon.

4656e6712b1e2dcde2119096d295f86ca4c639ad?t=83696f75a84918399a1f97480327058b

Step 2 - Enter the email address where you want the cron job results sent after each time it runs.

440438bdc4aeb0706a3dc25474d6fe508e20e86d?t=d68a165eccb520f08a16b1a158e2a230

Step 3 - Now you have to define exactly when and how often you want the cron job to run. This is made easier by using one of the pre-defined or common settings.
Notice that by choosing a common setting, all fields are filled in automatically. This also helps you understand what each field means

326ca4ff3a8bd13f9da07f996b4eccce837dc55c?t=f9faff8a204d0bb88c0bad454de47f72


Step 4 - Choose Once a week or an appropriate time for your task.

6a1ae10b4b27fda7fb1d3af52b6cd1da0070ad6b?t=52e6cf1705358571bfd2a03086955b63

Step 5 - Next, enter the command of the script you want to run, including the complete path. As an example, if you wanted to run the script 'script.sh' from your public_html folder, you would type:

/home/<cPanel_Username>/public_html/script.sh
54c6223769a1233977e797bd70cdae4218275602?t=262f8c3768d9d28f4522ba5150c68116

Step 6 - Click Add New Cron Job.

d6c2655c4e44660cdd456e2283613b0a72e83a64?t=8570c82b97bf179bc42f5d734d9cea50

Once created, you can view the existing CRON jobs down the bottom of the page.

c234d721b8c4b1089fcf647c3ff595b0d83cf7cb?t=e072e9db2ab59a0345d600bd9c14db5e

You can create additional CRON jobs, and edit or delete existing ones.

5776f4d985a48a28d7ca353494e3269a14857164?t=e600dda791c127865020d47180087739
Note: Many people set their CRON jobs to run on the first minute of every hour. In some cases, this can lead to load on the server depending on the amount and types of CRON jobs running. Consider setting your jobs to trigger on the 27th minute of every hour or a similar unusual time.

Note: Ensure you set the 'Minute' field correctly. If you set this to *, the Cron job will run every minute and cause high load on your cPanel. On Shared servers, Crons cannot be set to run more frequently than every 5 minutes.


Did you find this article useful?  

Related Articles

© Crucial