Score:0

Use supervisor to rerun failing cronjob?

lr flag

I want to execute a script every day from 07:00 AM for 17 hours. I managed to do so by setting up a cronjob that executes every day at 7 AM the following command:

/usr/bin/timeout --foreground 17h /home/adam/mycommand

Now this works basically, but the problem is that the script sometimes fails. If this happens, I would like to re continue the script for the remaining hours, so that it ends at 00:00 AM

My question is, can I achieve this with supervisor? I followed the tutorial but this just shows how to rerun a specific script and restart it when it fails. I don't know how to this in comination with cronjob and timeout

David avatar
cn flag
What do you mean by @supervisor@ there is no such user in Ubuntu.
mashuptwice avatar
it flag
It might help to identify the underlying cause of the failure first before searching a solution for an unknown problem
PonJar avatar
in flag
If you use a systemd timer and service combination you can start the service (your script) at 7am and restart it if it fails. Then you could think about some logic in your script to check the time and end if it’s between midnight and 6.59. It would also be sensible to try to diagnose why it’s failing.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.