简体   繁体   English

厨师Cron作业未运行

[英]Chef cron job not running

I have a Chef cron job that will not run for the life of me, I think the cron job format is correct since I used language-chef in atom to create it and it matches examples on the docs. 我有一个厨师的cron作业不会持续一生,我认为cron作业的格式是正确的,因为我在atom中使用language-chef来创建它,并且它与文档中的示例匹配。 I have played around with the timing and nothing works. 我在时间上玩弄,没有任何效果。 I have ran the command in the cron job by itself and it runs just fine so my command is correct. 我已经在cron作业中单独运行了该命令,它运行得很好,所以我的命令是正确的。

Cron job Cron工作

cron 'upl_base_backup.sh_cron' do
  minute '0'
  hour '1'
  weekday '6'
  command '/work-disk/postgresql-scripts/upl_base_backup.sh'
end

Output of crontab -u root -l crontab -u root -l的输出

# Chef Name: upl_base_backup.sh_cron
0 1 * * 6 /work-disk/postgresql-scripts/upl_base_backup.sh

Any ideas on why it might not be running? 关于为什么它可能无法运行的任何想法?

First set the script to be executable. 首先将脚本设置为可执行。

chmod +x /work-disk/postgresql-scripts/upl_base_backup.sh

Second add the full path to the sh executable which should be /bin/sh . 其次,将完整路径添加到sh可执行文件中,该路径应为/bin/sh But you can find that yourself, using whereis sh . 但是您可以使用whereis sh找到自己。

The cron entry might look like this: cron条目可能如下所示:

0 1 * * 6 /bin/sh /work-disk/postgresql-scripts/upl_base_backup.sh

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM