Scheduling Tasks
If you need to run scripts on your server at specific time, use the task scheduler facility on your server to make the system automatically run the scripts for you.
During installation of Plesk the following tasks are automatically created:
- autoreport.php – delivers daily, weekly and monthly reports on clients and domains (three separate tasks)
- backupmng – initiates scheduled backing up of domains once every 30 minutes
- statistics – generates statistics on the limits imposed on domains, such as traffic, disk usage, etc. If the utility detects that a limit is exceeded for a domain, this domain will be disabled
- mysqldump.sh - creates a backup copy of three MySQL databases: psadump, MySQL, and Horde databases
As all these tasks are related to domain statistics, databases and reports, it is strongly recommended that you neither change nor remove these tasks.
Important: To prohibit control panel users from scheduling tasks on behalf of user "root", create on the server's file system an empty file with name root.crontab.lock
in the location /plesk_installation_directory/var/
.
To schedule a task:
- Click the Server shortcut in the navigation pane.
- Click the
Crontab icon in the Services group. - Click
Add New Task. - Specify when to run your command:
- Minute - enter the value from 0 to 59
- Hour - enter the value from 0 to 23
- Day of the Month - enter the value from 1 to 31
- Month - enter the value from 1 to 12, or select the month from a drop-down box
- Day of the Week - enter the value from 0 to 6 (0 for Sunday), or select the day of the week from a drop-down box
You can schedule the time using the UNIX crontab entry format. In this format, you can
- enter several values separated by commas. Two numbers separated by a hyphen mean an inclusive range. For example, to run a task on the 4th, 5th, 6th, and 20th of a month, type 4-6,20.
- insert an asterisk to specify all values allowed for this field. For example, to run a task daily, type * in the Day of the Month text box.
To schedule the task to run every Nth period, enter the combination */N, where N is the legal value for this field (minute, hour, day, month). For example, */15 in the Minute field schedules the task to start every 15 minutes.
You can type the contracted names of months and days of the week, which are the first three letters: Aug, Jul, Mon, Sat, etc. However, the contracted names cannot be separated with commas or used together with numbers.
- Specify which command to run. Type it into the Command input box.
- Click OK.
To temporarily suspend execution of a scheduled task:
- Click the Server shortcut in the navigation pane.
- Click the
Crontab icon in the Services group. - Choose a task that you wish to suspend and click on the command name.
- Click the
Disable icon.
To resume execution of scheduled task:
- Click the Server shortcut in the navigation pane.
- Click the
Crontab icon in the Services group. - Choose a task whose execution you wish to resume and click on the command name.
- Click the
Enable icon.
To unschedule a task:
- Click the Server shortcut in the navigation pane.
- Click the
Crontab icon in the Services group. - Select a check box to the right of the task that you wish to unschedule.
- Click
Remove Selected. - Confirm removal and click OK.