Hey Linux Gurus!
Iīm kinda new in this, but i am trying my best and i think i am making good improvements.
I wrote that "PingPong" script and i thought that i might be a nice tool. It calls you when one of your servers/hosts are down.
I can even ping 10 different host with it, and i will alway get the message to my mobile phone.
All u need is a ISDN Card ;)
What do you think?
It might be a poor coding style, but HEY, it works ;)
 
Regards
Spiekey
 
==============================================================================
#!/bin/sh
egal=1
 
#internal/test
#Tel_nr="53"
Tel_nr="xxx1xx9x3xxx6xx7"
 
var_xxserver=-4
 
# well, i needed a loop so i made one up which will never come ;P
until [ $egal = 2 ]; do
 
############## 192.168.10.1 ##################
if ping -c 3 -w 10 -s 1 -i 30 192.168.x.x 1> /dev/null 2> /dev/null ;
then
        echo "`date` it's ping 192.168.x.x (xxserver)"
# donīt flood my logs
sleep 60
  else

   var_xxserver=$[var_xxserver+4]
   var_timer_xxserver=$[var_xxserver * 60]
   sleep $var_timer_xxserver
 
   if ping -c 3 -w 10 -s 1 -i 30 192.168.x.xx 1> /dev/null 2> /dev/null ;
   then
       echo "`date` it's ping 192.168.xx.x (xxserver)"
   else
 
  echo "`date` =====> Server is down, lets call the admin, hehe. I was sleeping for $var_timer_xxserver"
 
# try to call my mobile until u get thought ot the device is free
   i=1; until [ $i = 2 ];
   do
     if /usr/local/tools/ivcall/ivcall 98 $Tel_nr < /usr/local/tools/ivcall/xxserver.wav > /dev/null
      then
      i=$[$i+1]
      fi
   done
sleep 10
 
 fi
fi
done
 
exit
==============================================================================