Article View: comp.unix.shell
Article #272Re: file locking in shell scripts
From: Stephen R. van den Berg
Date: Mon, 03 Aug 1992 12:57
Date: Mon, 03 Aug 1992 12:57
27 lines
1709 bytes
1709 bytes
rvloon@cv.ruu.nl (Ronald van Loon) writes:
>How can I - within a shell script - lock the file exclusive for writing ? If
>that's not possible, what do I need to use to do so from C, for example ?
You could use the "lockfile" program part of the "procmail" package. This
"lockfile" program allows shell-script programmers to create NFS-safe
lockfiles.
To extract it from the "procmail" package:
unpack, cd procmail, make lockfile man/lockfile.1
Then copy both files to suitable places.
----------------------
A recent version can be picked up at various comp.sources.misc archives.
The latest version can be obtained directly from the ftp-archive at:
ftp.informatik.rwth-aachen.de (137.226.112.31)
as compressed tar file: pub/unix/procmail.tar.Z <128KB
or in compressed shar format: pub/unix/procmail.0?.Z
----------------------
--
Sincerely, berg@pool.informatik.rwth-aachen.de
Stephen R. van den Berg (AKA BuGless). berg@physik.tu-muenchen.de
"Listen very carefully, I shall only say this once."
Technical Details
Message-ID:
<1992Aug3.125744.19161@Urmel.Informatik.RWTH-Aachen.DE>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!sdd.hp.com!mips!darwin.sura.net!Sirius.dfn.de!Urmel.Informatik.RWTH-Aachen.DE!physik.tu-muenchen.de!bergReferences:
<1992Jul23.124327.20843@cv.ruu.nl>Show Full Headers
Complete Article Headers
Newsgroups: comp.unix.shell,comp.unix.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sdd.hp.com!mips!darwin.sura.net!Sirius.dfn.de!Urmel.Informatik.RWTH-Aachen.DE!physik.tu-muenchen.de!berg From: berg@physik.tu-muenchen.de (Stephen R. van den Berg) Subject: Re: file locking in shell scripts Message-ID: <1992Aug3.125744.19161@Urmel.Informatik.RWTH-Aachen.DE> Originator: berg@tabaqui Sender: news@Urmel.Informatik.RWTH-Aachen.DE (Newsfiles Owner) Nntp-Posting-Host: tabaqui Organization: Rechnerbetrieb Informatik / RWTH Aachen References: <1992Jul23.124327.20843@cv.ruu.nl> Date: Mon, 3 Aug 92 12:57:44 GMT Lines: 27