[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PSID



-----BEGIN PGP SIGNED MESSAGE-----

Hi

I must admit people are going to some lengths to solve simple non-problems:

        1. man pppd (version 2.2.something):
                ...
                FILES
                       /var/run/ppp<n>.pid      Process-ID for pppd process
                                                on ppp interface unit <n>.
                ...

        2. bash (or really any Bourne Shell clone (not csh/tcsh)):
                The variable $! contains the pid of the last
                background process launched

So you have one specific solution to the pppd problems (for however many
interfaces you may have) and another general solution to the
what-pid-have-I-started-now question.

All other solutions are based on quick polling of process table and therefore
subject to critical races.

In UNIX simple problems have simple answers,
complex problems are even easier :-)

        Oron

                
On 16-Sep-97 Gaal Yahas wrote:
>Ira Abramov wrote:
>
>> > > how would it be possible to determine which ps id the next program will
>> > > take, for example if i'm loading pppd and i'd like to know what psid
>> > > will or has pppd taken?
>> >
>> > Just
>> >       ps -aux | grep pppd | grep -v grep | awk '{ print $2 }'
>> > and smile ;)
>> 
>> you are assuming only one pppd runs on the system... how about a few
>> cyclades cards? one pentium 133 with enough memory can serve ppp to 128
>> lines...
>
>okay, so put a sort by date and tail the last entry before that awk.
>
>gy
- ---
Oron Peled                                      Voice/Fax: 972-4-8228492
oron@cs.technion.ac.il                http://www.cs.technion.ac.il/~oron

Support open hardware - http://www.debian.org/OpenHardware/

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv

iQCVAwUBNB7ZkoZNrY67uByxAQGF6AP+OZH+W6JeQbmrVJ6B+K6uNPN6BS333X8U
x0C5yaOUVH3sajTdnJvwf4DKzU1GzaDPKlwL239t2xxabwIFZlnl85Ddc2NeO8/M
2k6iXSsV9fjiOQQiWhtve7L+l0jo1L+PiqedhXTh36ryuuQv25mu5qPEUA/MHmSE
h5V/2B8rw+E=
=gkIC
-----END PGP SIGNATURE-----