small script help

Jack Stone jacks at sage-american.com
Thu Aug 23 22:57:08 UTC 2012


Running freebsd-7.0

I use a small script in a jail to check if Apache is running and if 
not, restart it.

#!/bin/sh
#if ps -ax | grep -v grep | grep -i httpd
#then
#    echo "Apache is alive......"
#else
#    echo "Apache is dead, but will be launched."
#/usr/local/etc/rc.d/apache22 start

However, if I want to check the host's Apache, ps -ax sees all of the 
"httpd" lines including the jail and the host:

(Jail) 83787  ??  SsJ    0:07.71 /usr/local/sbin/httpd -DSSL 
-DNOHTTPACCEPT
(host) 98089  ??  Ss    32:49.44 /usr/local/sbin/httpd -DNOHTTPACCEPT

How can I modify my script to see only the host based on the bottom 
line above?

Help appreciated!

Jack






More information about the freebsd-questions mailing list