目录
linux设置定时任务实行定时脚本
系统定时任务周期:每小时
控订定时任务目录:
[code]/etc/cron.hourly[/code]
定时 每小时顺序:
[code][root@localhost ~]# cd /etc/cron.hourly[/code]
[code][root@localhost cron.hourly]# touch 1.sh[/code]
[code][root@localhost cron.hourly]# chmod +x 1.sh[/code]
- 4.hourly内的可实行文件,每小时都会重新到尾的实行一遍。
系统定时任务周期:每一天
控订定时任务目录:
[code]/etc/cron.daily[/code]
[code][root@localhost ~]# cd /etc/cron.daily[/code]
[code][root@localhost cron.hourly]# touch 1.sh[/code]
[code][root@localhost cron.hourly]# chmod +x 1.sh[/code]
- 4.daily内的可实行文件,每天都会重新到尾的实行一遍。
系统定时任务周期:每一周
控订定时任务目录:
[code]/etc/cron.weekly[/code]
[code][root@localhost ~]# cd /etc/cron.weekly[/code]
[code][root@localhost cron.hourly]# touch 1.sh[/code]
[code][root@localhost cron.hourly]# chmod +x 1.sh[/code]
- 4.weekly内的可实行文件,每周都会重新到尾的实行一遍。
系统定时任务周期:每个月
控订定时任务目录:
[code]/etc/cron.monthly[/code]
[code][root@localhost ~]# cd /etc/cron.monthly[/code]
[code][root@localhost cron.hourly]# touch 1.sh[/code]
[code][root@localhost cron.hourly]# chmod +x 1.sh[/code]
- 4.monthly内的可实行文件,每月都会重新到尾的实行一遍。
设置实行时间
[code]vi /etc/crontab [/code]
- 如设置每天凌晨3:00实行cron.daily中的脚本:
[code]00 3 * * * root run-parts /etc/cron.daily[/code]
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。 来源:https://www.jb51.net/server/3261313sf.htm 免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作! |