How To Set Up A Cron Job

How To Set Up A Cron Job

Cron jobs are scheduled tasks that the system runs at predefined times or intervals. Typically, a cron job contains a series of simple tasks that the system runs from a script file.

Add a cron email

The Cron Email section of the interface allows you to enter an email address for the system to send notifications when your cron jobs run. To set an email address, perform the following steps:

In the Email text box, enter the email address at which you wish to receive the notifications.

Click Update Email.

Disable email notifications

To disable email notifications for all cron jobs, remove the email address.

To disable email notifications for a single cron job, perform the following steps:

Locate the following string: 0 * * * * /home/user/backup.pl

Add the following string to that line: /dev/null 2>&1

Save your changes.

Add a cron job

To create a cron job, perform the following steps:

Select the interval at which you wish to run the cron job from the appropriate menus, or enter the values in the text boxes.

  • Common Settings — This menu allows you to select a commonly-used interval. The system will configure the appropriate settings in the Minute, Hour, Day, Month, and Weekday text boxes for you.
  • Minute — Use this menu to select the number of minutes between each time the cron job runs, or the minute of each hour on which you wish to run the cron job.
    Hour — Use this menu to select the number of hours between each time the cron job runs, or the hour of each day on which you wish to run the cron job.
  • Day — Use this menu to select the number of days between each time the cron job runs, or the day of the month on which you wish to run the cron job.
  • Month — Use this menu to select the number of months between each time the cron job runs, or the month of the year in which you wish to run the cron job.
  • Weekday — Use this menu to select the days of the week on which you wish to run the cron job.

In the Command text box, enter the command that you wish the system to run.

Note: Specify the absolute path to the command that you wish to run.

Click Add New Cron Job.

Edit a cron job

To edit a cron job, perform the following steps:

Locate the cron job that you wish to edit and click Edit.

Edit the settings that you wish to change and click Edit Line.

Delete a cron job

To delete a cron job, perform the following steps:

Click Delete next to the cron job that you wish to delete.

Click Delete.

Leave a Reply 0