Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Dec 2005 17:57:18 +0300
From:      Sergey Zaharchenko <doublef-ctm@yandex.ru>
To:        Eric Schuele <e.schuele@computer.org>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: grep'ping the ps output....
Message-ID:  <20051213145718.GB30661@shark.localdomain>
In-Reply-To: <439D9FA3.7030603@computer.org>
References:  <439D9FA3.7030603@computer.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--KFztAG8eRSV9hGtP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hello Eric!

Mon, Dec 12, 2005 at 10:04:51AM -0600 you wrote:

> I was wondering if someone could explain why it is sometimes there and=20
> not other times.

Sometimes the ps process manages to catch the system state when grep has
not been started yet by the shell. Sometimes it doesn't.

> And how I should correctly go about detecting if the=20
> process is running before I perform my action.

You may use the -c flag of ps:

     -c      Change the ``command'' column output to just contain the exe-
             cutable name, rather than the full command line.

Like:

df@shark:~> ps axc |grep init
    1  ??  ILs    0:00,00 init

--=20
DoubleF
No virus detected in this message. Ehrm, wait a minute...
/kernel: pid 56921 (antivirus), uid 32000: exited on signal 9
Oh yes, no virus:)

--KFztAG8eRSV9hGtP
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (FreeBSD)

iD8DBQFDnuFNwo7hT/9lVdwRAvuTAJ4hdVQxnhLc54OS23XFTYUg0ZxUnwCfcvmJ
1CgAdR2wCq4a2pi9GV40hmo=
=TYWI
-----END PGP SIGNATURE-----

--KFztAG8eRSV9hGtP--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051213145718.GB30661>