Reference: http://www.cnblogs.com/xiaoluo501395377/archive/2013/04/06/3002602.html
For specific instructions, please refer to the article: Linux instructions.
Detailed version of the original recommendation.
Note (Personally, it is also tested): Different crontab files are used between users and users. This article is based on the assumption that it is done correctly.
Crontab uses: In Unix and Linux, to set the instructions that are executed periodically.
In Linux, Linux task scheduling is mainly divided into the following two categories:
1, the system performs the work: The system periodically performs the work, for example backs up the system data, cleans up the cache.
2, Personal work: a user to do regular work, such as every 10 minutes to check the mail server for new letters.
The tasks of the system scheduling are generally stored in the/etc/crontab file. Can be viewed using the CAT/ETC/CRONTAB directive.
[Email protected] ~]$ cat/etc/Crontabshell=/bin/Bashpath=/sbin:/bin:/usr/sbin:/usr/Binmailto=root# for details see Mans4crontabs# Example of Job definition:#.----------------Minute (0- -)# | .-------------Hour (0- at)# | | .----------Day of Month (1- to)# | | | .-------Month (1- A) OR jan,feb,mar,apr ... #| | | | .----Day of Week (0-6) (sunday=0Or7) OR sun,mon,tue,wed,thu,fri,sat#| | | | |# * * * * * * user-name Command to be executed
/etc/cron.allow indicates a user who can use crontab, this file is first recognized.
/etc/cron.deny represents a user who cannot use the crontab command
Ii.. crontab command syntax and the meanings of each parameter
The syntax for the crontab command is:
Description of each parameter:
-E [UserName]: Perform a text editor to set the time table, the default text editor is vi-R [UserName]: Delete the current schedule table-l [UserName]: List the current schedule table-V [UserName]: List the status of a user cron job
Iii. format of the crontab command
Users can use 'crontab-e ' to open their own crontab files for editing (the default is VI).
The format is as follows: Each field is split with spaces and tabs.
* * * * * Command path
Rules for dispatching commands: It is important to note that some upper and lower limits are different from everyday. such as: Week (0-6).
| Field name |
Range of values |
| Minutes |
0-59 |
| Hours |
0-23 |
| Date |
1-31 |
| Calendar |
1-12 |
| Week |
0-6 |
| Command name |
|
Some common special symbols in the crontab command:
| Symbol |
Description |
| * |
Indicate any moment |
| , |
Represents a split |
| - |
Represents a segment, as in the second paragraph: 1-5, which means 1 to 5 points |
| /n |
Indicates that each n unit executes once, as in the second paragraph, */1, which indicates that the command is executed every 1 hours. Can also be written as 1-23/1. |
Crontab instruction Detailed