34 points · by bigattichouse · 1y ago · 20 comments
I would say one good reason is that
waitlock myapp &
JOB_PID=$!
# ... do exclusive work ...
kill $JOB_PID
is a lot easier to use and remember than (; flock -n 9 || exit 1; # ... commands executed under lock ...; ) 9>/var/lock/mylockfile (; flock -n 9
and not ( flock -n 9
?Flock -s file && script.
Pretty simple. (I forgot the argument, I think is -s..
waitlock myapp & #... do stuff waitlock --done myapp