From owner-freebsd-questions Tue Feb 3 12:29:58 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id MAA27371 for questions-outgoing; Tue, 3 Feb 1998 12:29:58 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from citytel1.citytel.net (root@citytel1.citytel.net [204.244.99.66]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id MAA26997 for ; Tue, 3 Feb 1998 12:27:52 -0800 (PST) (envelope-from kwoody@citytel.net) Received: from citytel.net (citytelprct48.citytel.net [204.244.99.124]) by citytel1.citytel.net (8.8.8/8.8.5) with ESMTP id MAA18905 for ; Tue, 3 Feb 1998 12:26:53 -0800 (PST) Received: from mybsd.net (mybsd.net [192.168.0.2]) by citytel.net (8.8.5/8.8.5) with SMTP id MAA26054 for ; Tue, 3 Feb 1998 12:11:10 -0800 (PST) Date: Tue, 3 Feb 1998 12:11:09 -0800 (PST) From: Kwoody X-Sender: kwoody@mybsd.net To: freebsd-questions Subject: small script question.. Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe questions" I'm going away for a week and want to make sure my ppp stays running as I have RC5/DES stuff running on a few boxes and this FBSD machine is the gateway for them. I'm using an older version of PPP and every once in a blue moon it dies. (upgrade, I know but dont have the time at the moment) So I want a small script to run oh say every fe hours or something and check to see if ppp is up. If not run it. I wrote this little thing: #!/bin/sh ps ax | grep -v grep | grep -q city if ( test $? -eq 0 ) then echo "found" else echo "not found" echo "running ppp..." ppp -auto -alias city fi It works as far as I can tell. While testing it I was grepping for the word ppp and even if ppp was not running it would return "found". But as soon as I grepped for city instead it works and runs ppp fine. I use bash and the above if-then-else was from a book on shell programming. Is this a "right" way to do this? thanks, Keith