Locking from shell scripts (was Re: lpadmin(8) question)
Liam R. E. Quin
lee at sq.sq.com
Fri Jun 8 10:53:05 AEST 1990
In article <779 at mwtech.UUCP> martin at mwtech.UUCP (Martin Weitzel) writes:
>In article <475 at van-bc.wimsey.bc.ca> sl at van-bc.wimsey.bc.ca (Stuart Lynne) writes:
>[about locking from interface programs of the SysV spool system]
>Locking with FIFOs [...]
> It is essential that the daemon keeps
>the FIFO open for read and write, so that the character in it
>is never discarded! All in all it's a bit tricky to get this
>started, as you can open a FIFO from the shell only for read OR
>for write
You could investigate the <> syntax in the shell, which opens an
existing file in read-write mode. This was documented briefly in
System III as I recall, and also in a Unix quick-reference card of
about 1983 or so, but I've not seen it since.
Most shells actually use read/write in any case, although relying
on this might be a bad idea.
Script started on Thu Jun 7 20:49:38 1990
sqarc!lee> ls -l <> boy
boy: cannot open
sqarc!lee> date > boy
sqarc!lee> cat <> boy
Thu Jun 7 20:50:12 EDT 1990
sqarc!lee> cat boy
Thu Jun 7 20:50:12 EDT 1990
sqarc!lee> date 1<> boy
sqarc!lee> cat boy
Thu Jun 7 20:50:41 EDT 1990
sqarc!lee>
script done on Thu Jun 7 20:50:52 1990
Lee
--
Liam R. E. Quin, lee at sq.com, {utai,utzoo}!sq!lee, SoftQuad Inc., Toronto
``It's just an idea, and admittedly a half-baked, unlikely one. Still,
picking apart ideas is what the net is all about.'' [David Brin, _Earth_]
More information about the Comp.unix.questions
mailing list