Creating Cron Jobs in cPanel
As a webmaster, there may come a time in your life where you need to run automated tasks on preset schedules. Perfect examples would be if you are running an auction on your site or would like to schedule automatic backups of your MySQL databases. In this case, you need to set up a cron job. This article will provide some beginner tips on setting up cron jobs from the cPanel control panel.
Getting Starting
First things first – log in to your cPanel account and find the “Cron Job” icon on the interface. After clicking on the icon, you will be then be asked to choose an experience level. Since this a beginner’s tutorial, click on “Standard”.
Setting Up a Cron Job
Once you are inside of the “Standard Cron Manager”, it’s time to set up your cron job. You can either create it to execute at specific intervals or specific times. To create the cron job, follow these simple steps:
- Enter your preferred email address in the line that reads “Please enter an email address where the cron output will be sent”. By doing this, cPanel will automatically send you an email notification when the crob job is executed. If there were any problems, the message will let you know.
- Enter the full path to the script you want to run in the “Command to run” field. If it’s a PHP script you want to run, the command will start with “PHP”.
Schedule the Cron Job
Setting a schedule for your cron job requires a few more steps but is just as easy. Below are some of the options you have
- Set the Minutes(s): Here you can set up a short interval or minutes on the hour. If you are not concerned about minutes, simply leave this field to the default setting of “0″. If you want to test out your cron job, set it to run at “Every Five Minutes”. This is an ideal interval for running a script. If lets you check your email for any errors and then come back and make the corrections before your inbox gets flooded with cron messages.
- Set the Hour(s): There may be a few scripts you want to run each hour such as an RSS import. In this case, you would set the cron job for “Every Hour”. If you want to schedule a backup of your database, you may want to choose a late night hour or some weekend time when your site isn’t as busy.
- Set Day(s): Depending on what you have got going on, you may want to leave this option set to “Everyday” You do however, have the choice of selection certain days of the month. Additional cron job options include “Set the Weekday(s)” and “Set the Month(s)”.
After creating the schedule and clicking the “Save Cron” button that’s it – your cron job is done. If you set a brief interval for testing purposes, you should have a message waiting for you in your inbox within a couple of minutes. The email will tell whether or not the job was successful. In most cases, errors are the result of incorrect script paths.
Related tutorials and articles
Eco-Friendly Web Hosting - Save the Earth!
Powered by 100% Green Energy Web Hosting from HostPapa.com
Good Avocado - Professional Multiple Domain and Reseller Hosting
1 Response:
# vps on 23 Jan 2009 at 12:30 am
Leave a Reply

