Re: grepping in ps output
Hi ,
Just use eax with =out the "-" for linux.
example for named
ps eax | grep named | sed -e 's/^ *//' -e 's/ .*//'
Larry
At 12:18 AM 4/29/00 +0200, Paul van Empelen wrote:
>
>Hi,
>
>I am working on a bourne script that can restart services if they hang.
>If the process does not respond, I want to kill and restart it, but I
>haven't found a good way to locate it's process ID from the ps output.
>And not all processes use a /var/run/<file>.pid. With the commands
>ps ax | grep process, you sometimes see the 'grep process' in the output.
>That's not what I want.
>
>The following command works pretty well on Solaris. Does anybody know
>the Debian equivalent?
>
>PID=`ps $PSOPTION | grep $SERVICE| sed -e 's/^ *//' -e 's/ .*//'`
>(where $PSOPTION is -e for Solaris, and probably ax for Linux)
>
>Thanks,
>
>Paul.
>
>
>--
>To UNSUBSCRIBE, email to debian-isp-request@lists.debian.org
>with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>
>
Reply to: