From owner-freebsd-questions Thu Mar 23 14:16:14 1995 Return-Path: questions-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id OAA23351 for questions-outgoing; Thu, 23 Mar 1995 14:16:14 -0800 Received: from netcom.netcom.com (root@netcom.netcom.com [192.100.81.100]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id OAA23341 for ; Thu, 23 Mar 1995 14:16:05 -0800 Received: by netcom.netcom.com (8.6.10/Netcom) id NAA05443; Thu, 23 Mar 1995 13:41:23 -0800 From: dlr@netcom.com (dlr) Message-Id: <199503232141.NAA05443@netcom.netcom.com> Subject: ping under freebsd To: questions@FreeBSD.org Date: Thu, 23 Mar 1995 13:41:21 -0800 (PST) X-Mailer: ELM [version 2.4 PL23] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 1051 Sender: questions-owner@FreeBSD.org Precedence: bulk I am trying to cludge together a script that will test for the prescence of ppp and if it is not up or if it is not connected to my provider (ie modem went down but pppd still hung) that it will kill pppd and then run my startup script. Here is the script I am working on: #!/bin/sh # Is PPP interface up? if /sbin/ifconfig ppp0 | grep UP >/dev/null then # If so, test whether it is connected if ping -rc2 decker.mdn.com >/dev/null then echo "PPP up" else ps ax |grep pppd |grep -v grep pid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'` if [ "X${pid}" != "X" ] ; then echo 'killing pppd, PID=' ${pid} kill ${pid} /etc/ppplogin & fi fi fi ************************ I am not that great a unix scripts so no flamage please if it looks bad. However I will take any and all suggestions. the problem I am at now is that bsd ping returns a zeroeven if the connection isn't established. I want to run this as a cron process to keep my net up all the time Any suggestions? dave