Linux/lockfile

From Omnia
Jump to navigation Jump to search

lockfile - conditional semaphore-file creator

lockfile(1): conditional semaphore-file creator - Linux man page - https://linux.die.net/man/1/lockfile

Suppose you want to make sure that access to the file "important" is serialised, i.e., no more than one program or shell script should be allowed to access it. For simplicity's sake, let's suppose that it is a shell script. In this case you could solve it like this:

...
lockfile important.lock
...
access_"important"_to_your_hearts_content
...
rm -f important.lock

Install part of procmail:

apt install procmail