linux执行计划步骤,linux下定时执行计划任务(Scheduled execution tasks under Linux).doc...
linux下定时执行计划任务(Scheduled execution tasks under Linux)
linux下定时执行计划任务(Scheduled execution tasks under Linux)
Scheduled execution tasks under Linux
Published at 11:33 2007-11-25, author: wangyu1314
View the /etc/crontab file
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# run-parts
01 * * * * root run-parts /etc/cron.hourly
024 * * * root run-parts /etc/cron.daily
224 * * 0 root run-parts /etc/cron.weekly
4241 * * root run-parts /etc/cron.monthly
The first four lines are the environment variables that set the cron task running. The value of the SHELL variable specifies the SHELL environment used by the system (the sample is bash shell), and the PATH variable defines the path to execute the command. The output of the Cron in the form of an e-mail sent to MSILTO user name. If the MAILTO variable defined variable is defined as the empty string ("MAILTO="), e-mail will not be sent. Execute the command or script variables can be used to set the HOME home directory.
The description format for each line task in the file /etc/crontab is as follows:
Minute, hour, day, month, DayOfWeek, command
Minute - integers from 0 to 59
Hour - integers from 0 to 23
Day - integer from 1 to 31 (must be the valid date of the specified month)
Month - an integer from 1 to 12 (or as abbreviated as Jan or Feb)
DayOfWeek - an integer from 0 to 7, and 0 or 7 is used to describe Sunday (or Sun or Mon shorthand)
Command - commands that need to be executed (available as, LS, /proc, /tmp/proc, or instructions for executing custom scripts)
Root stands for running as a root user
"Run-parts" means a folder followed by all the scripts under that folder
For the above statements, the asterisk (*) represents all available values. For example, * when referring to month, it represents the command of the month (which needs to conform to other restrictions).
Integer between the hyphen (-) integer column, such as integer 1,2,3,4. is 1-4.
The specified value is separated by commas. For example, 3,4,6,8 represents the four specified integers
The