【问题标题】:Rails whenever gemRails 每当宝石
【发布时间】:2015-05-29 20:40:07
【问题描述】:

我正在尝试设置whenever gem,但我不能。 schedule.rb文件:

set :output, "#{path}/log/cron-whenever.log"

every '1 * * * *' do
  command "#{path}/sh_files/db_backup.sh"
end

设置:

 ~# whenever --update-crontab everything
 [write] crontab file updated
 ~# crontab -l

 # Begin Whenever generated tasks for: everything
  1 * * * * /bin/bash -l -c '/some/path/to/files/db_backup.sh >> /some/path/to/files/cron-whenever.log 2>&1'
 # End Whenever generated tasks for: everything

在启动 Rails 服务器并等待之后……什么也没有发生。没有logs 更新,做db_backup.sh 更新。没什么...而且我手动检查了/some/path/to/files/db_backup.sh 命令,它有效...

【问题讨论】:

  • 在 linux 上查看这里的日志tail -f /var/log/syslog
  • 检查 cron 状态。 service cron status
  • 这似乎是cron 问题,请检查 [reasons-why-crontab-does-not-work][1] [1]: askubuntu.com/questions/23009/reasons-why-crontab-does-not-work
  • @Marwen 谢谢!现在可以了。这是 PATH 问题,现在已修复 :)

标签: ruby-on-rails cron whenever


【解决方案1】:

根据Whenever gem

,它应该是 schedule.rb 而不是 scheduler.rb

【讨论】:

  • 是的,只是在我在这里写我的问题时打错了。它由$ wheneverize . 命令生成,我没有更改路径或文件名。还是不行。
猜你喜欢
  • 2019-08-09
  • 2015-08-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-07-13
  • 2015-10-03
  • 2017-09-02
  • 1970-01-01
相关资源
最近更新 更多