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.

 

It is highly important that you exercise caution when you schedule cron jobs.

If you schedule cron jobs to run too often, they may degrade server performance which may lead to account termination.

 

To start, add a cron email address at the Cron Email section of the interface so that the system will send notifications when your cron jobs run.

To set an email address, enter the email address in the Email text box at which you wish to receive the notifications.

Click Update Email.

If you want 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 cron job for which to disable email notifications in the Current Cron Jobs table and click Edit.

In the Command text box, add the/dev/null 2>&1 line to the end of the command.

 

For example:

/usr/local/cpanel/bin/is_script_stuck /dev/null 2>&1

Save your changes.

 

To create a cron job, perform the following steps:

1. 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 — 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 — 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 — 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 — 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 — 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 — The days of the week on which you wish to run the cron job.

 

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

 

You must specify settings for the Minute, Hour, Day, Month, Weekday, and Command text boxes.

Exercise extreme caution when you use the rm command in a cron job.

If you do not declare the correct options, you may delete your home directory’s data.

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

For example, if you wish to run the public_html/index.php file in your home directory, enter the following command:

/home/user/public_html/index.php

 

3. Click Add New Cron Job.

 

You can view existing cron jobs by looking at the Current Cron Jobs table which displays your existing cron jobs.

 

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.

 

 

To delete a cron job, perform the following steps:

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

Click Delete.

Bu cavab sizə kömək etdi? 0 istifadəçi bunu faydalı hesab edir (0 səs)