"The basic composition of Crontab"
① system service CROND: Refreshes the scheduled task from the configuration file every minute
② configuration file : Set up timed tasks by file mode
③ Configuration Tool crontab: Use to adjust timed tasks
Configuration file format for profile
* * * * * COMMAND
The first *: minutes 0-59,* means to execute every minute
Second *: hours 0-23
Third one *: date 1-31
Fourth one *: month 1-12
Fifth *: week 0-7 (0 or 7 = Sunday)
"Example 1" 21:30 restart Apache per night
* * * Service httpd restart
"Example 2" 1, 10, 22nd of 4:45 restart Apache
1,10,22 * * Service httpd restart
"Example 3" 4:45 restart Apache per month from 1 to 10th
1-10 * * Service httpd restart
"Example 4" restarts Apache every two minutes (no previous conditions)
*/2 * * * * Service httpd restart
"Example 5" odd minutes per hour restart Apache
1-59/2 * * * * Service httpd restart
Start restart at 1 minutes
(even 0-58/2)
"Example 6" from 11 o'clock to 7 a.m., every 1 hours (front conditional) Restart Apache
0 23-7/1 * * * Service httpd restart
Note: Minutes with 0, if used *, means 23 to 7 points any one minute to execute, obviously not the result we want
"Example 7" restarts Apache every 30 minutes from 18:00 to 23:00 daily (with conditions in front)
0,30 18-23 * * * Service httpd restart
Or
0-59/30 18-23 * * * Service httpd restart
Summary
①* means matches at any time.
② can use "a,b,c" to represent A or B or C when executing commands
③ can use a "a-B" to represent a to a/C when executing a command
④ can use "*/a" to execute commands once per A-minute (hour, etc.)
"Use of crontab tools"
Crontab Help Information
Crontab----help
① View a list of scheduled tasks for a user (Dee)
- u Dee
② Modifying a user's (Dee) scheduled task
CRONTAB-E-U Dee
With: Wq save exit (seemingly Ubuntu system exit Edit Schedule task to be more complicated)
③ View the resulting final scheduled task file
-/var/spool/cron
Use
Tail-f/var/log/cron
View Crontan's logs
Linux Scheduled Tasks Crontab notes and summaries (2) Basic composition and configuration of Crontab