MyBestRatedWebHosting's MBRW Second Semi-Annual 2011 Hosting Award has been officially announced! Save yourself time and money by reading our detailed review and learn who received the final award of the industry's best web host!

MyBestRatedWebhosting.com

How to Set Up a Cron Job

set up cron job

Throughout your tenor as a webmaster, there may be a few occasions where you need to create scheduled tasks for your website. Maybe your CMS needs a background program to run an auction your website is hosting. In such an instance, you will need to configure a cron job, which is function that enables this automated task to run. This can be done with shell access to the server using technologies such as SSH and Telnet or via your web host’s control panel. In this article we will detail the basics of how to set up a cron job with the cPanel control panel. Leading web host providers, such as BlueHost and Lunarpages, offer cPanel for your superior control and ease of administration.

Getting Started

To set up a cron job, log into your cPanel application and locate the “Cron Jobs” icon. After clicking on the icon, you will be asked to choose an experience level. Since you’re reading this article, it’s safe to assume that “Standard” is the appropriate option.

Setting Up a Cron Job

You can create a cron job from the Standard Cron Job Manager. The job can be configured to run at specific times or specific intervals, which only requires three simple steps:

1 First, enter your email address in the field that reads something like this: “Please enter an email address where the output will be sent”. When a job is executed, cPanel will forward a message stating so, notifying you if it was successful or if there were any errors.

2. Next, enter the path for your script in the “Command to run” field. If you are using a PHP script, the command will of course begin with “PHP”. If you want set up a cron job to run the automatic shell script that backs up your database, you would enter “/bin/sh” followed by the path to your script.

3. Step three is where you set the schedule for your cron job. Here are your choices:

Minute(s) – here you can configure short intervals or go by minutes on the hour. Multiple items can be selected by using the “Command” and “Shift” keys. For starters, you can set a job to run “Every Five Minutes”, which is a good for running scripts and checking your inbox for errors before it becomes flooded with cron job messages.

Hour(s) – if you are setting up a cron job to run an RSS Import script, configuring it for “Every Hour” may be a good idea. If you want to use a backup script, you may want to consider choosing an hour late in the night to assure that your database is backed up regularly after a full day’s work.

Days (s) – In most cases, you will be okay leaving this set to “Everyday”. You also have the choice of setting up cron jobs to run on certain days of the month or on a weekly or monthly schedule.

After setting a schedule for your script to run, the cron job is done. Simply click the “Save Cron Job” tab to complete the process. If you set up a short interval for testing purposes, you should receive an email within minutes confirming its execution. If the email reports an error, check your settings and script path as these are the most common problems.

See Hosting Comparison Chart

See Top 10 Web Hosting

Be Sociable, Share!
« »
24th August 2008
Posted by Web Hosting Consultant in Best Web Hosting Tips

One Response to “How to Set Up a Cron Job”

  1. Jose says:

    This is a much easier way than coding in the shell. Is it as stable?

    Report This

    Was this review helpful to you? : Thumb up 0 Thumb down 0

Submit your Review