beleive me, i read all the mails that others send to you and i can tell   
you that the best way is the "grep -v grep " trick.
counting the lines returned by "ps | grep" as suggested by someone will   
not work since there is a race condition.
sometimes "ps | grep program" will return only the interesting line,   
sometimes it will return 2 lines. so counting does not work in all cases.
i did not think of the "killall -0" trick, "grep program | grep -v grep"   
is better in the way that i tcan be used on every UNIX computer.

hope this helps
pascal


> -----Original Message-----
> From: Paul Murphy [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, July 25, 1999 6:06 PM
> To: Linux-Newbie
> Subject: Infinite Regression ?
>
>
> I am trying to write a script that tests if a certain program is
> running, I thought to use :
>
> if ( ps x | grep "program_name" }
>
> but this will ALWAYS return TRUE [from grep]. How to deal with this??
> --
> [EMAIL PROTECTED]
> http://www.geocities.com/PicketFence/1913/
>
> "I am not going to be happy until my living room looks like NORAD"
>   

Reply via email to