Date: Thu, 23 Mar 1995 13:41:21 -0800 (PST) From: dlr@netcom.com (dlr) To: questions@FreeBSD.org Subject: ping under freebsd Message-ID: <199503232141.NAA05443@netcom.netcom.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199503232141.NAA05443>
