Or learn to use lock files, which would make sure that your jobs don't run when another one is already running?
Unix shells offer the trap command, among other things, to cleanup, even in the case of errors, e.g.:
set -e LOCK=$(ensure-lock) trap "rm $LOCK" 0 1 2 15 do-job
Or learn to use lock files, which would make sure that your jobs don't run when another one is already running?
Unix shells offer the trap command, among other things, to cleanup, even in the case of errors, e.g.:
https://en.wikipedia.org/wiki/Semaphore_%28programming%29