prep stanza runs once and stops the block if it failed.
This is most often what one needs, but sometimes prep failures are transient: e.g. a script was unable to apply DB schema while PostgreSQL server is starting. In this case it would be nice to repeat prep until it succeeds.
I have tried wrapping prep stanzas in while ! x; do sleep 1; done, but this solution also has issues:
- It does not back-off
- It is a separate shell script that will continue to run if
ppow is brutally killed.
So, what I need is a hybrid between prep (run before other commands, allow other commands to run if prep succeeds) and daemon (rerun with backoff).
prepstanza runs once and stops the block if it failed.This is most often what one needs, but sometimes
prepfailures are transient: e.g. a script was unable to apply DB schema while PostgreSQL server is starting. In this case it would be nice to repeatprepuntil it succeeds.I have tried wrapping
prepstanzas inwhile ! x; do sleep 1; done, but this solution also has issues:ppowis brutally killed.So, what I need is a hybrid between
prep(run before other commands, allow other commands to run ifprepsucceeds) anddaemon(rerun with backoff).