3 ms·
Avoiding Multiprocess Errors in Bash Shell
- turtleyacht 3y agoIn case of Docker with root access or otherwise, there's also a caveat on the page before (p. 772, 3rd edition, emphasis theirs): --- This technique [36.27: Shell Lockfile, sent in from Greg Ubben] doesn't work for scripts run as the superuser (root). It depends on the fact that a standard user can't write a file without write permission. But root can write any file, whether it has write permission or not. If there's a chance that root might run your script, you might want to add a test of the UID--by running the id command, for instance--and be sure that the UID isn't 0 (the superuser's).