watchdogみたいなもん
openwrtの無線クライアント(無線的に遠方のやつ)に仕込み、
クーロンで一時間ごとにキックする。
5時間以上ネットワークが普通になったら、自分をリブート、
って手はず、のつもり。
root@pci-cqw-191:~# cat watchdog.sh #!/bin/sh #paramete HISTORYFILE="./watchdog_history.txt" COUNTERFILE="./watchdog_Count.txt" TH=6 DIST_IP="192.168.1.40" #init(file setup) if [ ! -f ${HISTORYFILE} ] then touch ${HISTORYFILE} fi if [ ! -f ${COUNTERFILE} ] then echo 0 > ${COUNTERFILE} fi echo "ping watchdog started" ( ping -c 10 ${DIST_IP} ) result=$? # 0 means OK # others means no-connection if [ $result -eq 0 ] then ( echo " *Good!" ) | tee -a ${HISTORYFILE} echo 0 > ${COUNTERFILE} else count=`cat ${COUNTERFILE}` count=$(($count + 1)) ( echo " *ooops count: <$count>" ) | tee -a ${HISTORYFILE} echo $count > ${COUNTERFILE} if [ $count -eq ${TH} ] then echo "totally $count times no-response. Oooooops rebooting now" ( echo "-------------------------rebooted on -------" date echo "--------------------------------------------" ) >> ${HISTORYFILE} echo 0 > ${COUNTERFILE} reboot ; exit fi fi root@pci-cqw-191:~#