Portal Home > Knowledgebase > How To's and more > How to set up Cron Jobs in cPanel


How to set up Cron Jobs in cPanel




Cron jobs allow you to automate repetitive tasks on the server that hosts your web site. This is a powerful tool that allows you to take a hands-free approach to repetitive tasks. For example, you could add a cron job that automatically copies a mySQL database to a separate location on your site as a backup. 

Warning: You need to have a good knowledge of Linux commands before you can use cron jobs effectively. Check your script with your hosting administrator before adding a cron job. 

To add or modify a cron job: 

1. Click on the Cron Jobs link in the Advanced Menu area. 

2. Enter the times for the cron job in the Minute, Hour, Day, Month, or Weekday fields. Refer to the following page to check exactly how to enter values in these fields - http://www.redhat.com/support/resources/tips/cron/cron.html 

3. Enter the cron job script in the Command field. 

Examples: 
::> is Right: 
curl -s http://domain.com/directoryname/emailfile.php > /dev/null
env php -q /home/username/public_html/directoryname/emailfile.php 
----------------------- 
::> is Wrong: 
env php -q http://domain.com/directoryname/emailfile.php 

4. Click on the "Commit Changes" button. Your cron job has now been added or updated. 

Note: You can always click on the "Reset Changes" button to change the cron job back to whatever it was before you started entering information. 
================================== 

Deleting a cron job: 

You can delete any cron job at any time. If you are unsure what a cron job is doing it is safer to delete it and check the code with your hosting administrator. 

To delete a cron job: 

1. Click on the Cron Jobs link in the Advanced Menu area. 

2. Click on the "Delete" button next to the required cron job. 

Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read