#!/bin/sh # # This is run after PPPoE goes down. # CYCLE=/usr/local/bin/cycle STAMP=/tmp/adsl-cycle.stamp PORT=/dev/ttyS1 # Port with the relay attached if test \! -x $CYCLE ; then exit 1 fi # # There are different failures: loss of sync, PPPoE server crash, # and a microcode lockup. Modem needs a long time to reconnect. # If we trip power every time when we restart PPP, we have to # wait too long in every cycle. Instead, we allow the modem # to reconnect asynchronously from PPP retry cycle. # if test -f $STAMP; then flag=$(find $STAMP -mmin +3 -exec echo "NEWER" \; 2>/dev/null) if test "$flag" = "NEWER"; then logger -t "adsl-lost" -p daemon.notice "Cycling modem power" $CYCLE $PORT > /dev/null 2> /dev/null < /dev/null date > $STAMP fi else touch $STAMP fi exit 0