#!/bin/csh -f # the python script is available here: https://usbnetpower8800.googlecode.com/svn/trunk/usbnetpower8800.py set LockFile="/tmp/power_cable_modem.lockfile" if (-e $LockFile) then echo "ERROR, $LockFile exists." > /dev/stderr exit 1 endif touch $LockFile set DT=`date +'%F %R:%S'` echo "${DT} - Power cycling cable modem." | tee -a /var/log/cablemodem.log /root/bin/usbnetpower8800.py off |& grep -v ignored sleep 5 /root/bin/usbnetpower8800.py on |& grep -v ignored sleep 1 /root/bin/usbnetpower8800.py query |& grep -v ignored #ssh -o BatchMode=yes -Nf hellmouth pfctl -k 172.22.0.0/16 -k 69.5.0.0/16 #ssh -o BatchMode=yes -Nf hellmouth pfctl -k 24.173.162.174 #ssh -o BatchMode=yes -Nf hellmouth pfctl -k 0.0.0.0/0 -k 24.173.162.174 #ssh -o BatchMode=yes -Nf hellmouth pfctl -k 172.22.0.0/16 -k irc.freenode.net #svc -t /service/znc.kmk # give a delay before running again so that we don't power the thing twice before it can recover. sleep 6m rm -f $LockFile #svc -t /service/ntpd