Linux System Scheduled Tasks
/etc/crontab Cron master configuration file, you can define path
The cron format is as follows:
#.----------------minutes (0-59)
# | .-------------hours (0-23)
# | | .----------Day (1-31)
# | | | .-------Month (1-12)
# | | | | .----Week (0-6) (Sunday =0 or 7)
# | | | | |
# * * * * * * user-name command to be executed
Cron is also a service, so you need to start the service to be effective: service Crond start; Service Crond Status
crontab-e : Writing task opportunities, similar to using VIM to open the crontab configuration file
crontab-l: View the Scheduled Tasks
crontab-r: Deleting Scheduled Tasks
Check if the Crond service has been started
Service Crond Status
[[Email protected] ~]# service Crond Statuscrond (PID 1072) is running ...
Start the Crnod service
Service Crnod Star
Task Schedule Exercises:
Clear/var/log/slow.log This file every 1:20 A.M.
Execute "/bin/sh/usr/local/sbin/backup.sh" every Sunday 3 o'clock
14th # 4:10 per month to execute "/bin/sh/usr/local/sbin/backup_month.sh"
Perform "Ntpdate time.windows.com" every 8 hours
1 points per day, 12 points, 18 points to execute "/bin/sh/usr/local/sbin/test.sh"
"/bin/sh/usr/local/sbin/test2.sh" is executed from 9 to 18 every day.
Crontab-e into the editing mode, write the content, and then quit saving, it is necessary to note that the format must be written to, or can not be saved, will be error
1 * * * echo "0" >/var/log/slow.log
0 3 * * 0/bin/sh/usr/local/sbin/backup.sh
4 * */bin/sh/usr/local/sbin/backup_month.sh
0 */8 * * * ntpdate time.windows.com
0 1,12,18 * * */bin/sh/usr/local/sbin/test.sh
0 9-18 * * */bin/sh/usr/local/sbin/test2.sh
This article is from the It Exchange Learning blog, so be sure to keep this source http://sxct168.blog.51cto.com/824373/1659673
Linux System Scheduled Tasks