0

I want to run a rake task at end of month, but according to the post below cron doesn't provide a easy way for it.

Cron job to run on the last day of the month

Therefore I wrote like this:

every "50 23 30 4,6,9,11 *" do
  rbenv_rake "foo:update"
end
every "50 23 31 1,3,5,7,8,10,12 *" do
  rbenv_rake "foo:update"
end
every "50 23 28 2 *" do
  rbenv_rake "foo:update"
end

Is there wrapper method in whenever to write the code simpler?

Community
  • 1
  • 1
ironsand
  • 14,329
  • 17
  • 83
  • 176
  • 0 50 23 L * ? did you give this a try. i checked this link from http://www.quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger. not sure if it is going to help you. because wiki says L is non standard. but you can give it a try. – Athar Jul 20 '15 at 07:02
  • Thanks, but if it's non standard way I'll stick the way I wrote. Even if it works in my current environment, I don't want to use uncertain code. – ironsand Jul 20 '15 at 09:56
  • yes that would be best approach. keep things standardize – Athar Jul 20 '15 at 09:59

2 Answers2

0

Why can't you run some script 10 minutes later?

every "0 0 1 * *" do
  rbenv_rake "foo:update"
end
Alex Antonov
  • 14,134
  • 7
  • 65
  • 142
0

Should try this -

  every 1.month, :at => '00:00am' do
    rbenv_rake "foo:update"
  end
Amit Suroliya
  • 1,515
  • 1
  • 11
  • 21