# !/bin/bash # # # # something i wrote for a buddy, purpose?? i have no idea, but here it is # ping 192.168.1.3 see if its up, if not copy inetd2 over to inetd.conf and restart # inetd basically.... # if 192.168.1.4 is down, revert to original config and retry test in 4 minutes # run as a cron job every 5 minutes? # */4 * * * /path/to/pingtest.sh >/dev/null # here we go # fill in the values # addy1 is the default host we want up all the time # # # Sigterm # Rooted Networks # sigterm@rootednetworks.com addy1=192.168.1.3 inetorig=/etc/inetd.conf inet1=/etc/inetd.1 inet2=/etc/inetd.2 # lets begin with the test cp inetorig /etc/inetd.conf.original ping -c 2 -i 3 $addy1 if [ $? != 0 ] ; then echo "Couldn't ping $addy1, somethings fux0red" if [ -f $inet2 ] ; then echo "copying inetd.2 over to inetd.conf" cp $inet2 $inetorig killall -HUP inetd else exit1 fi else if [ -f $inet1 ] ; then echo "host is up restoring original config" cp $inet1 $inetorig killall -HUP inetd fi fi