我想yum每月运行一次更新,现在实际上每天都在运行。
我可以0yum-cron从cron.daily移至cron.monthly吗?如果是,那么我们如何知道它将在该月的哪一天和哪一天运行?
在合理范围内,您可以在cron.hourly、cron.daily、之间移动任何您喜欢的东西。 cron.weeklycron.monthly
但要小心,因为如果您删除/移动由包管理器(例如 yum)安装的配置文件,那么将来的系统升级可能会尝试将配置文件添加回来。所以当你移动它时,你可能想在它的位置留下一个空白文件......我不能保证这会阻止 yum 将来覆盖它。
通常,计时是从 中的条目配置的/etc/crontab。如果您在那里找不到任何内容,请检查文件/etc/cron.d
例如,在 ubuntu 服务器上配置了一个默认的 crontab,指定:
# /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/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 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 )
Run Code Online (Sandbox Code Playgroud)
据此,我的服务器将在每个月的 1 号运行 /etc/cron.monthlyroot脚本6:52。