1

I am using whenever for scheduling in my rails app. I could not find how to run my cronjobs on every tuesday and friday of the week anywhere in the gem's documentation.

This is what I am doing right now is this correct?

every [:tuesday, :friday], at: '12:00am', :roles => [:my_role] do
  runner "User.notify"
end
Roman Kiselenko
  • 43,210
  • 9
  • 91
  • 103
joker
  • 21
  • 2

1 Answers1

7

You can use the plain crontab syntax in the schedule.rb

every '0 0 * * 2,5', :roles => [:my_role] do
  runner "User.notify"
end

'0 0 * * 2,5' - “At 12:00 on Tuesday and Friday.”

It's pretty simple:

Minute   Hour    Day of Month       Month          Day of Week
(0-59)  (0-23)     (1-31)    (1-12 or Jan-Dec)  (0-6 or Sun-Sat)
 0        0         *                *               2,5

Refs for help 1, 2

Roman Kiselenko
  • 43,210
  • 9
  • 91
  • 103