【问题标题】:At what time does cron dialy run? (On EC2 Ubuntu)cron 每天几点运行? (在 EC2 Ubuntu 上)
【发布时间】:2019-01-23 11:59:54
【问题描述】:

所以我正在运行 EC2 Ubuntu,我最近将实例的时区(使用 tzselect)更改为 GTM -03,因为这是我的当地时间,然后我检查了 /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 )

根据我读到的内容,这应该意味着每天早上 6.25 运行,但我似乎不喜欢。如果此时间适用于实例的时区,则加上 idk。

没有 /etc/anacron 文件。

【问题讨论】:

    标签: ubuntu amazon-ec2 cron


    【解决方案1】:

    假设您的系统上没有安装 anacron,并且时区正确且本地时间正确,那么您示例中的 daily.cron 将在早上 6:25 运行。

    如果安装了 anacron,那么您需要查找变量 RANDOM_DELAY 和 START_HOURS_RANGE 以确定 daily.cron 将运行的“近似”时间范围。

    【讨论】:

    • 如何找到是否安装了 anacron?我应该在哪里寻找这些变量?感谢您的回答!
    • 你有文件 /etc/anacrontab 吗?列出已安装的包:apt-get list。
    • 谢谢!我刚刚使用 apt-get 安装了 anacron 并添加了您指定的变量
    猜你喜欢
    • 2018-06-16
    • 2015-09-17
    • 2012-02-14
    • 2023-04-09
    • 2019-02-28
    • 1970-01-01
    • 2014-12-08
    • 1970-01-01
    • 2015-03-29
    相关资源
    最近更新 更多