top | item 44590345

(no title)

Zacru | 7 months ago

Because that's a syscall ;) https://man7.org/linux/man-pages/man1/flock.1.html is the command line manual.

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

discuss

order

yjftsjthsd-h|7 months ago

Why

  (; flock -n 9
and not

  ( flock -n 9

?

apopapo|7 months ago

It's a "for" loop.

permalac|7 months ago

Flock can be used in a single line for example for cronjobs.

Flock -s file && script.

Pretty simple. (I forgot the argument, I think is -s..

bigattichouse|7 months ago

just pushed a change so now it's:

waitlock myapp & #... do stuff waitlock --done myapp