每当宝石出现Rails

时间:2015-05-29 12:13:56

标签: ruby-on-rails cron whenever

我试图设置whenever宝石,但我不能。 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命令,它有效......

1 个答案:

答案 0 :(得分:0)

根据Whenever gem

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