mcuadros / ofelia

A docker job scheduler (aka. crontab for docker)
MIT License
3.06k stars 175 forks source link

Potential bug when trying to schedule a job every 15 minutes + feature request #234

Open aefruswg opened 1 year ago

aefruswg commented 1 year ago

Running a job every 15 minutes causes numerous containers to spin up for the 60 seconds between X:15 and X:16. Once time hits X:17, containers stop being created. I tested by setting a schedule for the same container to run @hourly and only one instance was created. The schedule is defined as ofelia.job-run.job.schedule: "* */15 * * * *" ` using labels in a compose file

Edit: the same behavior happens if the schedule is defined as ofelia.job-run.gfrsync.schedule: "* 15 * * * *", so this has more to do with it being set for a particular minute than repeating

I'd also like to request the ability to name a container being created by Ofelia. Using the container label with job-run doesn't name the container and I have the container set to not be deleted so we can review logs if it fails. Not the biggest deal, but having it named something that isn't an auto-generated would be helpful

Hope this is still being maintained because it's a helpful tool and there don't seem to be many alternatives

UnwishingMoon commented 1 year ago

Ofelia's cron work a bit different compared to the basic cron in linux. In ofelia the first value represents the seconds and not the minutes. The other values works the same

In your case the cron * */15 * * * * means that the job runs at every second when the minute is /15 To just run the job one time at /15 the cron has to be the following: 0 */15 * * * * (if you want to run at second 0)

Can't help with the feature request at the moment