尝试在 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
有什么想法吗?
最佳答案
你可能想检查你的 crontab 语法; /etc/crontab
等位置的 crontab 文件需要额外的用户名字段,例如:
* * * * * root echo hi >> /root/test
这在 crontab(5)
中有记录(不是很突出):
Jobs in /etc/cron.d/
The jobs in cron.d and /etc/crontab are system jobs, which are used usually for more than one user, thus, additionally the username is needed....
关于ubuntu - docker ubuntu cron -f 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30529057/