【发布时间】:2016-02-18 14:41:53
【问题描述】:
在服务器上,我们有以下 cronfile:
MAILTO=admin_email@project.com
* * * * * /bin/bash -l -c 'cd /path/to/project/folder;RAILS_ENV=production bundle exec rake some_rake_task'
0 */2 * * * /bin/bash -l -c 'cd /path/to/project/folder;RAILS_ENV=production bundle exec rake another_rake_task'
# and so on
将其移至whenever 没有问题:
config/schedule.rb:
every '* * * * *' do
rake 'some_rake_task', output: 'log/cron.log'
end
every '0 */2 * * *' do
rake 'another_rake_task', output: 'log/cron.log'
end
# and so on
问题是我如何在任何时候实现 MAIL_TO 选项,以便在出现任何问题时通知管理员?
谢谢!
【问题讨论】:
标签: ruby-on-rails ruby cron rake whenever