如何在月初触发发条任务?

时间:2016-10-04 15:57:49

标签: ruby-on-rails clockwork

我想在每个月初都运行任务。 E.g:

2017-01-01 00:00:00 // January has just started
2017-02-01 00:00:00 // February has just started ...
...

如何使用发条做到这一点?

1 个答案:

答案 0 :(得分:4)

使用:

every(1.day, 'myjob', at: '00:00', :if => lambda { |t| t.day == 1 }) do ... end