I. Description of CRONTAB
Linux crontab task scheduling is to perform the corresponding tasks within the specified time frequency.
Ii. details of crontab documents
1. crontab files in Linux/etc/crontab
2. View crontab File # Vi/etc/crontab file description below
Shell=/bin/bash
Path=/sbin:/bin:/usr/sbin:/usr/bin
Mailto=root
home=/
# for details see Mans 4 Crontabs
# Example of Job definition:
#.----------------Minute (0-59)
# | .-------------Hour (0-23)
# | | .----------Day of Month (1-31)
# | | | .-------month (1-12) OR jan,feb,mar,apr ...
# | | | | .----Day of Week (0-6) (sunday=0 or 7) or Sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * * user-name command to be executed
Iii. crontab Command Description
crontab [-u username] [-l|-e|-r]
Parameters:
-U: Only root can do this task, that is, to help other users new/delete crontab work schedule;
-e: Edit Crontab's work;
-L: Consult Crontab's work content;
-R: Delete all the work of crontab, if you want to delete only one item, please use-e to edit.
Special characters |
Representative meaning |
* (asterisk) |
Mean to accept at any moment. For example, the day, month, and week of an example are *, which means that the follow-up order is executed 12:00 on the day of the week, regardless of the month. |
, (comma) |
Represents the meaning of the separation period. For example, if the work to be performed is 3:00 and 6:00, it will be: 0 3,6 * * command The time is still five columns, but the second column is 3,6, representing 3 and 6. |
-(minus) |
Represents a period of time, for example, between 8 and 12 hours of 20 points per hour of work: 8-12 * * * command Look carefully at the second column to become 8-12. The meaning of representing 8,9,10,11,12 |
/n (Slash) |
n represents a number, which is the meaning of every n unit interval, for example, every five minutes: */5 * * * command with * and/5来, can also be written in 0-59/5, the same meaning |
Iv. examples
CRONTAB-E; Open the current user schedule edit
* * */sbin/service httpd Restart * * * /sbin/service sshd Start * * * /sbin/service sshd Stop * * Fsck/home * * * * /home/bruce/backup ; # every Monday to Friday 3 o'clock, in the directory/home, look for files with the file name *.xxx and delete the files 4 days ago. #每月的1, 11, 21, 31st Yes 6:30 execute the LS command once
Finally, thank the following two bloggers for sharing
Linux task Scheduling operating mechanism reference http://blog.csdn.net/zhongbeida_xue/article/details/51280292
Linux task scheduling operation reference Http://www.cnblogs.com/mingforyou/p/3930636.html
Linux crontab Task Scheduler