> I am running an EigerStein-2beta LRP and I want to check if the pppd
> deamon is still running.
>
> I would have done something like:
>
> if [ ps ax | grep -v grep | grep -q /usr/sbin/pppd ]
>
> But...
>
> grep doesn't do "-v" or (I think) "-q".
>
> This must be simple, could an expert out there help me please?

The "grep" provided with many LEAF/LRP verisons is actually a shell-script
wrapper that uses sed.  Typically, no switches are supported, and no status
is returned based on 'found' or 'not found'.  Some newer distributions use
the busybox grep function, which should support the switches you want to
use.

As David pointed out, you can generally use sed instead of grep to do what
you want, but if your system doesn't have the busybox grep, you probably
don't have the wc function either...

You can generally replace 'wc -l' with sed -n '$=', although you won't get a
zero output if there are no lines.

You might also want to do something like:
ps ax | sed -n '/sed/d;\:/usr/sbin/pppd:p'

The single sed command first deletes any lines containing 'sed', then prints
any lines containing '/usr/sbin/pppd'.  You could simply test the output of
this for non-zero length to see if pppd is running:
if [ -n "`ps ax | sed -n '/sed/d;\:/usr/sbin/pppd:p'`" ] ...

Charles Steinkuehler
http://lrp.steinkuehler.net
http://c0wz.steinkuehler.net (lrp.c0wz.com mirror)



_______________________________________________
Leaf-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user

Reply via email to