Routine work arrangement for crontab in Linux
1. What is crontab?
Periodically process the daemons for to-do items, and the class dead task schedule.
2.crontab command resolution.
Example:
0 0 * * 1-5 cd/home/hiperry;/shutdwon.sh >/logs/shutdwon.log 2>&1
--Executes a custom shutdown script at 12 o'clock every night and writes log information to the specified log file.
Command resolution:
#----------------minutes (0-59)
# |-------------hours (0-23)
The day of the month of the----------(1-31)
# | | | |-------month (1-12) OR jan,feb,mar,apr ...
# | | | | |-----WEEK (0-6) (sunday=0 or 7) or Sun,mon,tue,wed,thu,fri,sat
# | | | | |
* * * * * * * The command to be executed
> represents where to redirect, for example: echo "123" >/home/123.txt
1 indicates stdout standard output, the system default is 1, so ">/dev/null" is equivalent to "1>/dev/null"
2 indicates stderr standard error
& means equal to, 2>&1, indicating 2 output redirection equals 1
2>&1 indicates that all standard output and error output will be redirected to a file called Out.file
3.crontab Common operation
Listing crontab files: crontab-l
Edit crontab File: crontab-e
Delete crontab file: crontab-r