Linux CentOS USES crontab to set the method for a timed restart
- 2020-10-31 22:05:58
- OfStack
This article describes setting up the timing task for crontab and adding crontab to boot.
1. Configure a daily automatic restart function:
If crontab is supported, you can view the existing timer tasks directly from ES8en-ES9en
If the current linux does not support crontab you need to configure it:
# The installation Crontab
yum install vixie-cron crontabs
# Set boot up Crontab
chkconfig crond on
# Start the Crontab
service crond start
First column 1 below the existing Crontab to see:
crontab -l
Hint: no crontab for root
Nothing, so add one:
Edit command:
crontab �e
Press i to enter edit mode and enter
30 15 * * * root /sbin/reboot
Means restart the device at 15:30 p.m. each day. Press ESC to enter command mode, type wq to save and exit.
Finally, restart crontab to make the restart function effective
service crond restart
Call it a day!
Supplement: Crontab Basic format:
* * * * * command
Time runs weeks The command
The first 1 Columns represent minutes 1 ~ 59 Use or per minute /1 said
The first 2 Columns represent hours 1 ~ 23 ( 0 said 0 Point)
The first 3 Columns represent dates 1 ~ 31
The first 4 Column represents month 1 ~ 12
The first 5 Column identification number week 0 ~ 6 ( 0 Say Sunday)
The first 6 Lists the commands to run
conclusion