Rails 3和crontab - Crontab日志为空

时间:2012-02-23 13:45:13

标签: ubuntu ruby-on-rails-3.1 crontab ruby-1.9.3 whenever

我在我的ruby on rails app上实现了gem。这个gem生成了配置文件,我在那里有这样的数据:

配置/ schedule.rb

set :output, "/vol/www/apps/logs/cron_log.log"                                #Log for production.
set :my_path, "/vol/www/apps/ror_tutorial/current"

every 5.minutes do
  command "cd #{my_path} && bundle exec rake thinking_sphinx:index RAILS_ENV=production && bundle exec rake thinking_sphinx:rebuild RAILS_ENV=production && chmod 777 -R #{my_path}/log"
end

所以这会在crontab中生成这样的代码:

$ crontab -e

# Begin Whenever generated tasks for: ror_tutorial
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /bin/bash -l -c 'cd /vol/www/apps/ror_tutorial/current && bundle exec rake thinking_sphinx:index RAILS_ENV=production && bundle exec rake thinking_sphinx:rebuild RAILS_ENV=production && chmod 777 -R /vol/www/apps/ror_tutorial/current/log >> /vol/www/apps/logs/cron_log.log 2>&1'

# End Whenever generated tasks for: ror_tutorial

Everuthing有效,但 cron_log.log 为空。为什么?我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

查看crond的启动位置。可以关闭日志记录级别。 This post here解释得很清楚。