如何更改cron.daily在linux中运行的时间

如何更改cron.daily在linux中运行的时间,第1张

概述我在cron.daily中有一个脚本,每天早上在某个时间运行.我需要改变运行的时间. 如何更改cron.daily运行脚本的时间? 在Red Hat 5或更早版本中,这是在/ etc / crontab中控制的. 较新的版本使用/etc/anacrontab.默认情况下,cron.daily脚本在4:02运行.编辑/ etc / crontab将修改该时间. # run-parts01 * * 我在cron.daily中有一个脚本,每天早上在某个时间运行.我需要改变运行的时间.

如何更改cron.daily运行脚本的时间?

解决方法 在Red Hat 5或更早版本中,这是在/ etc / crontab中控制的.

较新的版本使用/etc/anacrontab.默认情况下,cron.daily脚本在4:02运行.编辑/ etc / crontab将修改该时间.

# run-parts01 * * * * root run-parts /etc/cron.hourly02 4 * * * root run-parts /etc/cron.daily22 4 * * 0 root run-parts /etc/cron.weekly42 4 1 * * root run-parts /etc/cron.monthly

在Debian / Ubuntu系统上,这也在/ etc / crontab中控制.

例如;默认的Ubuntu 12.04安装:

# /etc/crontab: system-wIDe crontab# Unlike any other crontab you don't have to run the `crontab'# command to install the new version when you edit this file# and files in /etc/cron.d. These files also have username fIElds,# that none of the other crontabs do.SHELL=/bin/shPATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin# m h dom mon dow user  command17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )#

在任何一种情况下,您可以在此处找到有关使用何种语法的更多详细信息:http://linux.die.net/man/5/crontab或在几乎任何linux系统上运行man 5 crontab.

总结

以上是内存溢出为你收集整理的如何更改cron.daily在linux中运行的时间全部内容,希望文章能够帮你解决如何更改cron.daily在linux中运行的时间所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1045414.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存