Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Aug 2012 17:57:06 -0500
From:      Jack Stone <jacks@sage-american.com>
To:        freebsd-questions@freebsd.org
Subject:   small script help
Message-ID:  <5036B542.1040509@sage-american.com>

next in thread | raw e-mail | index | archive | help
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







Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5036B542.1040509>