[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: waiting for other process..
On Wed, 21 Oct 1998, Oron Peled wrote:
> On 21-Oct-98 Peter L. Peres wrote:
> > ...
> > file named such as:
> >
> > /tmp/I_am_it.1234
> >
> > for which the controlling program looks to find it. The directory where
> > ...
> You practically suggest polling for an event (file existence
> in your example). BAD, BAD, BAD. If we all used techniques
> like that we would have Linux-NT systems :-)
Yes, but there are no portability concerns. This will work on any Unix,
Coherent, even DOS (sans PID of course). For scripts that do not belog to
the same pgrp this is often the only way to go without digging deep into
the machine's peculiarities. BTW the original PID and tty locking method
is exactly this. Also, lpd uses this in its spool dirs. Daemon PID files
exist partly for this (ls /var/run), but are read using cat to yield the
pid, because there is only one of them. A shell script can advertise
itself by doing something like:
touch /tmp/$0.$$
in Bash. This is automagically unique in a session and can be found by
other processes.
Peter