【问题标题】:docker ubuntu cron -f is not workingdocker ubuntu cron -f 不工作
【发布时间】:2015-08-12 06:56:39
【问题描述】:

尝试在 docker 容器中运行 cron 作业。 正确配置 supervisord
(我在ps -ef 中看到了cron -f,如果我杀了它,它就会重生)

crontab 文件(用于测试):
* * * * * echo hi >> /root/test

我尝试将其放入 /etc/cron.d/crontab /etc/crontab/var/spool/cron/crontabs/crontab

没有任何效果 - 我在 /root/test 中没有得到任何东西

有什么想法吗?

【问题讨论】:

  • 您可能想在您的容器中添加一个 syslog 守护程序,以查看 crond 是否记录了任何错误。您可能还需要检查您的 crontab 语法; /etc/crontab 等位置的 crontab 文件需要额外的用户名字段(例如,* * * * * root echo hi >> /root/test)。
  • 确实是额外的用户名。谢谢!想提交它作为答案吗?
  • 很高兴它有帮助。已发布!

标签: ubuntu cron docker


【解决方案1】:

你可能想检查你的 crontab 语法; /etc/crontab 等位置的 crontab 文件需要额外的用户名字段,例如:

* * * * * root echo hi >> /root/test

这在crontab(5) 中有记录(不是很突出):

/etc/cron.d/ 中的作业

cron.d 和 /etc/crontab 中的作业是系统作业,通常用于更多 不是一个用户,因此,还需要用户名....

【讨论】:

    猜你喜欢
    • 2015-05-20
    • 2018-12-21
    • 2011-06-13
    • 2016-09-02
    • 1970-01-01
    • 2018-12-26
    • 1970-01-01
    • 2018-08-29
    • 1970-01-01
    相关资源
    最近更新 更多