Cron Jobs are a utility designed to execute programs (usually maintainence tasks) automatically as per a user-defined preset schedule. Cron Jobs are to Unix what Task Scheduler is to Windows.
The cron job interface in the HostRocket control panel consists of six fields...the five smaller fields (Minute, Hour, Day, Month and Weekday) are used to specify the schedule the command you are running is to be executed and the longer sixth text entry field (Command) is used for your command itself.
Cron jobs can be used to run any command which can be executed via a command prompt in a shell session. It can be used to execute standard Unix commands, programs and even Perl and PHP scripts. Here are some general examples of scheduling when you want your commands to be run:
|0||*||*||*||*||every hour on the hour|
|0||0||*||*||*||every day at midnight|
|0||0||*||*||0||every week at midnight on Sunday|
|0||0||1||*||*||every month at midnight on the 1st of the month|
|0||0||1||1||*||every year at midnight on the 1st of January|
There are many possible uses for cron jobs. One of the more common/popular uses is to automatically run custom scripts.
- Go to your Control Panel
- Click on the Cron Jobs icon
- Enter the appropriate values in the Minute, Hour, Day, Month and Weekday fields to schedule the day(s) and time(s) you wish your cron job task to run
- Enter the command you wish to have executed in the Command field
- Click the 'Add New Cron Job' button
Things to Note
- Make sure to reference the full and exact server path to the files called in your cron job commands
- Use common sense and consideration of others on your shared server when scheduling your cron jobs, particularly when dealing with more demanding tasks (ex: don't setup scripts to update every minute on the minute and avoid the excessive scheduling of any scripts which are likely to put a heavy load on the server)
- Our terms of service prohibits cron jobs from executing more frequently than once every 10 minutes
- Try to avoid using 0 0 * * * (midnight) when scheduling daily tasks. As so many users have cron jobs setup to run daily at the stroke of midnight whenever possible use a more "off peak" time such as 37 4 * * * (4:37 AM) when substantially fewer users are likely to have jobs scheduled.