Rails cron with whenever, setting the environment

前端 未结 10 2084
孤街浪徒
孤街浪徒 2021-01-30 13:15

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 =&g         


        
10条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-30 14:12

    I would consider using the "rake" shortcut to make it even cleaner:

    every 1.day, :at => '4am' do
      rake "thinking_sphinx:stop"
      rake "thinking_sphinx:index"
      rake "thinking_sphinx:start"
    end
    

提交回复
热议问题