我在 cron.daily 中有一个脚本,每天早上在某个时间运行。我需要更改它运行的时间。
如何更改 cron.daily 运行脚本的时间?
eww*_*ite 28
在 Red Hat 5 或更早版本上,这是在/etc/crontab.
较新的版本使用/etc/anacrontab. 默认情况下,cron.daily脚本在 4:02 运行。编辑/etc/crontab将修改那个时间。
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
Run Code Online (Sandbox Code Playgroud)
在 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/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)
无论哪种情况,您都可以在此处找到有关使用何种语法的更多详细信息:http : //linux.die.net/man/5/crontab或通过man 5 crontab在几乎所有 Linux 系统上运行。
小智 0
如果线路不存在,这将无法解决任何问题。
尝试查找提到 cron.daily 的地方,使用
grep -R cron.daily /etc
Run Code Online (Sandbox Code Playgroud)
然后从那里拿走它。
| 归档时间: |
|
| 查看次数: |
49466 次 |
| 最近记录: |