【发布时间】: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