Rails cron with whenever, setting the environment
问题 This question will probably only make sense if you know about the whenever gem for creating cron jobs. I have a task in my schedule.rb like every 1.day, :at => '4am' do command "cd #{RAILS_ROOT} && rake thinking_sphinx:stop RAILS_ENV=#{RAILS_ENV}" command "cd #{RAILS_ROOT} && rake thinking_sphinx:index RAILS_ENV=#{RAILS_ENV}" command "cd #{RAILS_ROOT} && rake thinking_sphinx:start RAILS_ENV=#{RAILS_ENV}" end However when I update my crontab using whenever --update-crontab appname --set