#!/usr/local/bin/bash
ping -q -c 5 -W 60 8.8.8.8 > /dev/null 2>&1
if [ $? -ne "0" ] ; then
ipfw show | grep "00321"
if [ $? -ne "0" ] ; then
ipfw add 321 setfib 2 ip from "table(0)" to not me in
echo `date` "channel 1 down, switched to the backup" >> channel_status.txt
fi
else
ipfw show | grep "00321"
if [ $? -eq "0" ] ; then
ipfw delete 321
echo `date` "channe 1 up" >> channel_status.txt
fi
fi