为什么我的 cron 作业没有在 OS X 上运行(由每当 gem 配置)?
我已经设置了一个 cron 作业,每当 gem 就使用伟大的。
every 1.minute do
runner "PeerReview.start_feedbacks"
end
我设置了 cron 作业:
whenever --set environment=development --update-crontab
crontab 文件看起来很好,它显示:
* * * * * /bin/bash -l -c 'cd /path_to_app/ && script/rails runner -e development '\''PeerReview.start_feedbacks'\'' >> log/cron_log.log 2>&1'
如果我执行运行程序,它工作正常,但是, cron 作业似乎不起作用(我也没有看到正在创建的日志) 。
我缺少什么?
(我正在 Mac OS X,10.6.6)
更新
我想我发现了问题:路径名包含空格,并且这没有被正确处理每当 gem 时,crontab 填写不正确(缺少所需的反斜杠),因此执行了 cronjobs,但命令的路径是错误的。
I have set up a cron job, using the great whenever gem.
every 1.minute do
runner "PeerReview.start_feedbacks"
end
I set up the cron job with:
whenever --set environment=development --update-crontab
The crontab file looks fine, it shows:
* * * * * /bin/bash -l -c 'cd /path_to_app/ && script/rails runner -e development '\''PeerReview.start_feedbacks'\'' >> log/cron_log.log 2>&1'
If I execute the runner, it works fine, however, the cron job doesn^t seem to work (also I don't see a log being created).
What am I missing?
(I'm working on Mac OS X, 10.6.6)
update
I think I identified the problem: The path name contains spaces, and this wasn't handled correctly by the whenever gem, the crontab was filled incorrectly (the needed backslashes are missing), so the cronjobs are executed, but the path for the command is wrong.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以上均已正确完成。
Rails 应用程序位于路径名中包含空格的目录中,在设置 crontab 时,whenever gem 不会转义这些空格。
All above was correctly done.
The rails app was in a directory with spaces in the path names, those spaces were not escaped by the whenever gem, when setting up the crontab.