#!/sbin/runscript # $Header: $ depend() { need net after modules } start() { einfo "Starting Internet connection..." ebegin " Checking interface..." CheckIFace eend ebegin " Checking line status..." CheckLine eend ebegin " Bringing ${IFLink} up" if [ -x "$(which pppd)" ] then if [ -f "/etc/ppp/peers/${Peer}" ] then einfo " Conncting to ${Peer}..." start-stop-daemon --start\ --exec $(which pppd) call ${Peer} > /dev/null else eend " ${Peer} not found in /etc/ppp/peers" fi else eend " pppd daemon not found" fi eend } stop() { einfo "Stopping Internet connection..." ebegin " Bringing ${IFLink} down" if [ -x "$(which ifconfig)" ] then if [ -z "$(/sbin/ifconfig | egrep "$IFLink")" ] then # Link is not up but pppd may be running ewarn " Interface seems to be down already" fi einfo " Stopping pppd" start-stop-daemon --stop --pidfile /var/run/${IFLink}.pid fi eend } ################################################################################ CheckLine() { if [ "`cat /proc/net/atm/ueagle-atm:0 | grep Line | grep up | wc -l | awk '{print$1}'`" != "0" ] then pppd call ${Peer} else sleep 5 CheckLine fi } CheckIFace() { if [ -e "/var/run/${IFLink}.pid" ] \ && [ -n "$(/sbin/ifconfig | grep $IFLink)" ] then einfo " Connection already established. Exiting" exit elif [ -e "/var/run/${IFLink}.pid" ] \ && [ -n "$(/sbin/ifconfig | grep $IFLink)" ] then ewarn " ${IFLink} link is up but there is no established\ conncetion. Killing ${IFLink} process..." start-stop-daemon --stop --pidfile /var/run/${IFLink}.pid einfo " Done ;)" fi } # vim:ts=4