【问题标题】:cron resource not working in aws opswork?cron 资源在 aws opswork 中不起作用?
【发布时间】:2013-07-10 14:34:30
【问题描述】:

我的食谱中有这个脚本

cron "logs_processPageView" do
  minute "*"
  hour "*"
  day "*"
  month "*"
  weekday "*"
  command %Q{
    echo "hi" >> /home/ubuntu/test.txt
  }
  action :create
end

当我使用 opswork 运行配方时,这是相应的日志

[Fri, 12 Jul 2013 02:42:48 +0000] DEBUG: Processing cron[logs_processPageView] on test1.localdomain
[Fri, 12 Jul 2013 02:42:48 +0000] DEBUG: Cron 'logs_processPageView' not found
[Fri, 12 Jul 2013 02:42:48 +0000] INFO: Added cron 'logs_processPageView'

{代码}

我假设 cron 已添加到 cron 作业中。

但是当我 ssh 到实例时,没有 test.txt,即使我等了一个小时。当我运行 {code}sudo crontab -l{code} 或 {code}crontab -l{code} 时也没有新的 cronjob。

为什么资源没有添加 cronjob?

我尝试使用cron cookbook。 /etc/cron.d/cronfile 中有新文件,但 cron 仍然无法工作。

我做错了什么?以及如何解决?

【问题讨论】:

  • 我也面临同样的问题。日志显示 cron 已添加,但“contab -l”显示没有 cron 作业。

标签: amazon-web-services cron chef-infra chef-recipe aws-opsworks


【解决方案1】:

这是一个错误,因为 opswork 使用的是 Chef 9(非常过时的 Chef)。

目前他们已经升级到 Chef 11.4,所以你可以再试一次,因为我在问题中的脚本现在正在运行。

【讨论】:

    猜你喜欢
    • 2016-11-12
    • 2018-06-26
    • 2023-04-11
    • 2019-09-16
    • 1970-01-01
    • 2020-05-03
    • 2016-10-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多