知道在 cron 每周运行之前还剩多少时间?

dyn*_*mic 5 linux debian cron

我在 debian 6 上。

有什么方法可以查看cron每周开始前还剩多少天?

小智 4

系统 crontab 通常定义在/etc/crontab/. 在这里定义了 cron.weekly、cron.daily 等的时间间隔。我的/etc/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 *   *   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)

所以我的 cron.weekly 将在一周的第 7 天的 6:47 运行。

编辑:以上信息仅适用于 /etc/cron.weekly 目录中的脚本。正如Iain所指出的,@weekly 被定义为在周日午夜运行。