Rails cron with whenever, setting the environment

前端 未结 10 2102
孤街浪徒
孤街浪徒 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:16

    For Whenever (0.9.2)

    Use the @environment variable for environment check:

    case @environment
    
    when 'production'
    
    every 1.minutes do
    
       rake "user:take_sample"
    
      end
    
    when 'development'
    
    every 1.minutes do
    
      rake "user:dev_sample"
    
      end
    
    end
    

提交回复
热议问题