I prepared one bash script which aim is to reboot the computer if its web server is down for approx. 30 minutes. I think that bash script might be useful for others on this list, so I'm posting it here.
But, I'm not sure what is the best way to run that script.
I'm using Suse 9.3 on the server. Should I make it runnable in /etc/init.d as daemon or there is some easier way?

Script's code:

#!/bin/bash
#bash script which reboots the computer when web server is down for approx. 30 minutes
serverFailure=0
while [ true ]
do
   wget -t 1 -T 30 -q www.mysite.com

   if [ $? != 0 ]; then
       #echo 'server is down!';
       serverFailure=$(($serverFailure + 1));
       if [ $serverFailure -gt 3 ]; then
echo 'too many server failures... going to reboot' >> ~/reboot.log ;
           date >> ~/reboot.log
           reboot
fi
   else
       echo 'server is up!';
       serverFailure=0
   fi
   #echo 'ServerFailure='$serverFailure;
   sleep 7m
done




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to