Linux/lockfile

From Omnia
Revision as of 22:50, 20 November 2018 by Kenneth (talk | contribs) (Created page with "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 mak...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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