文件/etc/crontab为服务器定时脚本文件,对定时脚本做的解释。
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59) 分钟
# | .------------- hour (0 - 23) 小时
# | | .---------- day of month (1 - 31) 日期
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ... 月
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat 周
# | | | | |
# * * * * * user-name command to be executed 命令
1.开启。
/sbin/service crond start
centos 7 为 /bin/systemctl start crond.service
2.查看当前定时执行的脚本
crontab -l
3.编辑
crontab -e
或者直接修改文件
/etc/crontab
例如每天早上8点执行/var/local/shell/a.sh脚本
0 8 * * * /var/local/shell/a.sh