From owner-freebsd-questions@FreeBSD.ORG Tue Dec 13 14:57:41 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0362716A422 for ; Tue, 13 Dec 2005 14:57:41 +0000 (GMT) (envelope-from doublef-ctm@yandex.ru) Received: from annex.ru (mail.annex.ru [213.80.160.13]) by mx1.FreeBSD.org (Postfix) with SMTP id EA45343D45 for ; Tue, 13 Dec 2005 14:57:30 +0000 (GMT) (envelope-from doublef-ctm@yandex.ru) Received: (qmail 28995 invoked from network); 13 Dec 2005 14:57:46 -0000 Received: from unknown (HELO shark) (83.239.189.189) by -v with SMTP; 13 Dec 2005 14:57:46 -0000 Received: by shark (Postfix, from userid 1000) id 57CDE9DB23; Tue, 13 Dec 2005 17:57:18 +0300 (MSK) Date: Tue, 13 Dec 2005 17:57:18 +0300 From: Sergey Zaharchenko To: Eric Schuele Message-ID: <20051213145718.GB30661@shark.localdomain> Mail-Followup-To: Sergey Zaharchenko , Eric Schuele , FreeBSD Questions References: <439D9FA3.7030603@computer.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="KFztAG8eRSV9hGtP" Content-Disposition: inline In-Reply-To: <439D9FA3.7030603@computer.org> X-Listening-To: Silence User-Agent: Mutt/1.5.11 Cc: FreeBSD Questions Subject: Re: grep'ping the ps output.... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Dec 2005 14:57:41 -0000 --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--