为什么 cron.weekly 不运行?

Cob*_*ast 8 bash cron debian-squeeze

当我注意到我放在 /etc/cron.weekly Debian6 服务器上的备份脚本没有执行时,我将这个小脚本放在其中,以查看是否执行了每周的 cronjob:

#!/bin/bash
echo 'CRON RAN' > /var/log/cron-weekly-runcheck.log
Run Code Online (Sandbox Code Playgroud)

将其另存为

-rwxr-xr-x 1 root root 64 Jul 15 02:14 /etc/cron.weekly/runcheck.sh
Run Code Online (Sandbox Code Playgroud)

当我今天检查时,它应该创建的日志文件不存在。
crontab 如下所示(据我所知,这应该是默认的 debian6 crontab):

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    * * 1   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)

在任何日志文件中显示每周 cronjob 的所有内容都是这一行:

Jul 16 06:47:01 wtwrp /USR/SBIN/CRON[29272]: (root) CMD (test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ))
Run Code Online (Sandbox Code Playgroud)

旁注:cron.daily自 logrotate 工作以来似乎工作。cron.hourly里面没有脚本。

关于可能出什么问题的任何想法?

kri*_*ssi 20

cron.weekly脚本开始通过run-parts其将跳过扩展名的文件。重命名runcheck.shruncheck,它应该做

  • 我敢打赌,这种事情你只会被抓到一次。 (4认同)