fcron icon indicating copy to clipboard operation
fcron copied to clipboard

Question/Feqture Request: re-run failed job earlier than scheduled

Open kopp opened this issue 1 year ago • 1 comments

Is it possible to configure fcron such that a job is executed every 10 hours of uptime and if it fails to execute re-try after 2 hours (rather than wait for the next 10 hour schedule)?

If this possibility does not exist, then this is a feature request. Consider for example backups. I want them to run every x hours, and if they failed, I want to re-try earlier, because my data is not actually backed up.

kopp avatar Nov 25 '24 09:11 kopp

When you say fail, do you mean that fcron does run the job, but it exited with a non-zero code?

If so, no... fcron does email on failure (and can be configured to email only on failure, see the option erroronlymail), but it won't retry it by itself. We could imagine adding another option to do what you described, e.g. maybe a retrydelay (for "@"-lines). Note I am unlikely to work on this anytime soon, but someone might be happy to work on a PR.

In the meantime, you could use a hacky workaround like running your job every 2h, but wrap it in a script that checks if the previous attempt failed, or if it's the 5th time the wrapper runs since the last successful run of the job (if you hadn't already ended up doing something like this).

yo8192 avatar Jan 01 '25 17:01 yo8192