On Sat, 20 Jan 2001, John H Darrah wrote:

>
> On Thu, 18 Jan 2001, Chuck Carson wrote:
>
> >
> >
> > I am trying to grep for a process as follows:
> >
> > [root@ora3]:/usr/local/admin# ps -ef | grep ntpd
> > root     24634     1  0 Jan11 ?        00:40:21 /usr/local/bin/ntpd -p
> > /var/log/
> > root     27476 27214  0 09:25 pts/21   00:00:00 grep ntpd
> >
> > Solaris does not print the 2nd line, but RH 62 does. Does
> > anyone know any tricks to prevent the second line from
> > being displayed.
> >
>
> A more robust solution would be:
>
>   ps -ec | awk '$6 ~ /ntpd/ {print; exit}'

you know, if what you're trying to do is get the PID of the
ntpd process, the *proper* way would be to examine the file
/var/run/ntpd.pid, at least under red hat linux.

i know that the /var/run directory contains *.pid files for
most system services, so i'm assuming it has one for ntpd
as well.  then you can stop dicking around, grepping and
awking.

rday

-- 
Robert P. J. Day
Eno River Technologies, Durham NC
Unix, Linux and Open Source training


"This is Microsoft technical support.  How may I misinform you?"



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to