From owner-freebsd-questions@FreeBSD.ORG Thu Aug 23 22:57:08 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9B19C1065670 for ; Thu, 23 Aug 2012 22:57:08 +0000 (UTC) (envelope-from jacks@sage-american.com) Received: from mail.sagedata.net (mail.sagedata.net [38.106.15.121]) by mx1.freebsd.org (Postfix) with ESMTP id 7793D8FC12 for ; Thu, 23 Aug 2012 22:57:08 +0000 (UTC) Received: from [192.168.1.67] (99-111-143-21.lightspeed.crchtx.sbcglobal.net [99.111.143.21]) by mail.sagedata.net (8.14.5/8.14.5) with ESMTP id q7NMv1YR064038 for ; Thu, 23 Aug 2012 17:57:01 -0500 (CDT) (envelope-from jacks@sage-american.com) X-Authentication-Warning: mail.sagedata.net: Host 99-111-143-21.lightspeed.crchtx.sbcglobal.net [99.111.143.21] claimed to be [192.168.1.67] Message-ID: <5036B542.1040509@sage-american.com> Date: Thu, 23 Aug 2012 17:57:06 -0500 From: Jack Stone User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: milter-spamc/1.15.388 (mail.sagedata.net [38.106.15.121]); Thu, 23 Aug 2012 17:57:02 -0500 X-Spam-Status: NO, hits=-10.00 required=4.50 X-Spam-Report: Content analysis details: (-10.0 points, 4.5 required) | | pts rule name description | ---- ---------------------- -------------------------------------------------- | -0.0 SHORTCIRCUIT Not all rules were run, due to a shortcircuited rule | -10 ALL_TRUSTED Passed through trusted hosts only via SMTP | Subject: small script help X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Aug 2012 22:57:08 -0000 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