首頁  >  問答  >  主體

linux - anacron的时间戳文件记录的时间为什么只到"日"而没有具体到时和分?

以下引用鸟哥的话:

anacron 是透过该记录与目前的时间差异,了解到是否应该要进行某项任务的工作! 举例来说,如果我的主机在 2009/03/15(星期天)
18:00 关机,然后在 2009/03/16(星期一) 8:00 启动,由於我的 crontab 是在早上 04:00
左右进行各项任务,由於该时刻系统是关机的,因此时间戳记依旧为 20090315 (旧的时间), 但是目前时间已经是 20090316
(新的时间),因此 run-parts /etc/cron.daily 就会在启动过 65 分钟后开始运行了。

疑问点是:时间戳只精确到3月15日和3月16日,那linux怎么知道3月16日开机时间一定是在4:00之后?换句话说,如果在3月16日3:00就开机,那么anacron还会执行4:00的crontab任务吗?

巴扎黑巴扎黑2743 天前840

全部回覆(1)我來回復

  • PHP中文网

    PHP中文网2017-04-17 13:03:17

    Anacron can be used to execute commands periodically, with a frequency specified in days. Unlike cron(8), it does not assume that the machine is running continuously. Hence, it can be that the machine is running continuously. Hence, it can be that. hours a day, to control daily, weekly, and monthly jobs that are usually controlled by cron.

    anacron 本來就只精確到天的,所以記錄上次是哪天運行的就可以了。

    如果我有一個例行任務是在某天10點,但我在9點關機,又在11點開機

    這種事 anacron 做不到。你只能說,這個任務每天運行一次,或每週運行一次,或每月運行一次。

    PS: 如果是 dcron 的放,它會把所有錯過的任務都跑一次的。

    回覆
    0
  • 取消回覆