#!/bin/bash # # # grabip # v1.0 (initial) # 08/4/2006 # # Brett Krueger # brett.krueger@ficoh.com # # # Check to see if FICOH gateway is on the network, if not... switch to DR type IP scheme # For our DR IFL Linux boxes in Colorado to come up with the correct IP and not # have to manually intervene to bring it online. # # INFO: # Put this in /etc/rc.local to be executed as one of the last things after the system # is up and running. IE) echo "sh /root/grabip.sh" >> /etc/rc.local # # # GLOBALS # Ficoh and DR routers(Gateways) ROUTE1=x.x.x.x ROUTE2=x.x.x.x # Configs for the switch go here. IP_DEST=/etc/sysconfig/network/cfg-eth0 # the ip configs DR_IP=/root/DR/dr_switch FICOH_IP=/root/DR/ficoh_switch # MAIN DO NOT EDIT ping -c 3 -i 3 $ROUTE1 if [ $? != 0 ] ; then echo "Couldn't ping $ROUTE1, im not at ficoh anymore toto" if [ -f $DR_IP ]; then echo "loading up DR config, hold on to your hat" cp $DR_IP $IP_DEST /etc/init.d/network restart else exit1 fi else echo "FICOH ALIVE, w00t" exit1 fi