Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger Clockwork task at the beginning of the month?

I would like to run task every beginning of the month. E.g.:

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

How to do this using clockwork?

like image 551
knagode Avatar asked Mar 11 '23 00:03

knagode


1 Answers

Use:

every(1.day, 'myjob', at: '00:00', :if => lambda { |t| t.day == 1 }) do ... end
like image 117
ishe_ua Avatar answered May 05 '23 13:05

ishe_ua