4 ms·
That solves reentrancy, when you don't want two copies of a script active at once, but what if you only want to run the lines in a script that weren't already r
by tenebrisalietum 5y ago
That solves reentrancy, when you don't want two copies of a script active at once, but what if you only want to run the lines in a script that weren't already run on last invocation?
- ruined 5y agowrite 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.