3 ms·
write the actual script in a heredoc, and wrap it in a script that pipes it line-by-line into a shell and tees to the lockfile. then, if the script stops, you h
by ruined 5y ago
write the actual script in a heredoc, and wrap it in a script that pipes it line-by-line into a shell and tees to the lockfile. then, if the script stops, you have a journal of what's executed so far, and the next execution can just skip everything duplicated in the logckfile.
totally foolproof except for the race condition between when your script crashes and you hit up-arrow then enter, someone else with your user account might change it maliciously.