ofelia
ofelia copied to clipboard
Can I specify a command to run once then on a schedule?
I'm thinking of a situation where I want to run a job once when ofelia starts up, then the same job every 60 minutes after that.
Currently if I use @hourly
or @every 60m
, ofelia will start up and then wait 60 minutes before running the job for the first time. I want it done now then hourly.
I admit I haven't looked too deeply into the go-cron supported commands, there might be a way to specify it that I am missing.
Not sure if this is currently possible, but I think a new optional parameter can be added like run-on-start
. If you can send a PR would be awesome, because not sure when I have time to pick that up.
Thanks.
Another point to make about this, is I'd like the hourly schedule to be based on when the first job is run.
For example if I start the containers at 12:45, I'd like it to run once at 12:45, then schedule each hourly job for for 13:45, 14:45 etc. Rather than 12:45, 13:00, 14:00 etc.
There is an inconsistency in the go-cron documentation, at one point it mentions @hourly
is run every hour "at the top of the hour" which I guess means at 0 minutes. Then elsewhere in the docs it says @hourly
is run every 60 minutes after the service starts.
Do you know which is correct?
There is also a ton of request for this feature in the cron lib which has not yet landed
https://github.com/robfig/cron/pull/436
This is what's blocking it in ofelia