One-time Scheduled tasks
At the specified time to execute a specific command
Usage: at [TIME]
Example:
At 9:00am #指定在当天早上9点执行计划任务
At > Cp/etc/passwd/tmp #计划任务内容
At > <EOT> #输入完成后, End by Ctrl+d
At-l List Current Scheduled tasks
Recurring Scheduled Tasks--crontab
Crontab-l List Scheduled Tasks
#service Crond Restart Restart
A) Use to open the service first
#service crond Status
#chkconfig--list List system service status
#chkconfig--list | grep crond View Crond service startup status
b) Specify the content of the scheduled task
Crontab content Format
First column |
Second column |
Third column |
Fourth column |
Fifth Column |
Sixth column |
Score of |
When |
Day |
Month |
Week |
Command |
00~59 |
00~23 |
1~31 |
1~12 |
0~7 |
Cmd |
Week: 0~7, 0 and 7 all indicate Sunday
, if time is the time period, you can
Use a horizontal bar (-) to denote a continuous period of time
Use a comma (,) to indicate a number of discontinuous times
Use an asterisk (*) to indicate all times
Use Division sign (/) to indicate the time interval
b) Specify the content of the scheduled task
* * * * * cmd
Example: Every Wednesday 2 o'clock in the morning backup/etc/passwd
0 2 * * 3 cp/etc/passwd/tmp
Example: 10th No. 25th per month, 1:5 A.M. Clear/tmp
5 1 10,25 * * rm-rf/tmp/*
Example: Performing time synchronization every 10 minutes
*/10 * * * * * * ntpdate time server IP
Example: 1-6 hours a day.
0 1-6 * * * *
c) Restart Crond service
#service Crond Restart
View Files Dynamically
Tail-f/tmp/date.log
Linux Scheduled Tasks