Cron Jobs

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.

Using Crontab

  • 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.

 

  • crontab, cronjob, cron, cron jobs
  • 2 Пользователи нашли это полезным
Помог ли вам данный ответ?

Связанные статьи

What is phpMyAdmin and how do I access it?

phpMyAdmin is a PHP-based MySQL database administration utility which can be used to modify and...

Creating MySQL databases

(cPanel) To create a MySQL database: Go to MySQL Databases in your cPanel Under 'Create New...

Using PHP 5.3 or Prior

While our shared servers do allow for the selection of multiple PHP versions, we highly recommend...

Why am I receiving a 'Cannot Connect to Database' error?

Receiving a 'Cannot Connect to Database' error indicates that the database settings entered in...

Is ImageMagick available at HostRocket?

Yes. We can install ImageMagick on any/all servers upon request, and most of our servers already...