Get cygwin. Its all the fun of unix for your windows box.

cygwin! cygwin! cygwin! I really love cygwin!

-Tim


tomcat guy wrote:
Whoops... I forgot to mention the machine checking the remote server is my
roommates Win2k box!

Any chance someone would have some code for that?

I keep saying I'll learn Linux (not a big fan of Bill) but that darm problem
with the Earth's rotation staying at a measly 24 hours/day is killin me!


----- Original Message ----- From: "Mike Jackson" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Tuesday, February 25, 2003 1:12 PM Subject: RE: Script for checking remote server



Ok, I've got an example, I cut out ip's and the "SendMsg" function, but

you


ought to be able to figure out where to go from here. Also it doesn't

check


tomcat via wget of a jsp, it does a rsh and checks for the process.  This
doesn't help if tomcat is hung up, but that hasn't been much of a problem

as


of yet.

#!/bin/sh

while [ true ]
do
   # check the router first
   if [ $RTN -ne 0 ]; then
       if [ ! -f message.${ROUTER} ]; then
           SendMsg "Something is wrong with ${ROUTER}" ${ROUTER}
       fi
       sleep 60
       continue
   elif [ -f message.${ROUTER} ]; then
       SendMsg "${ROUTER} is ok now" ${ROUTER} REMOVE
   fi

   # Check the server(s), shouldn't do this if the router is down, but
we'll set that up later
   for SERVER in real-ls-server real-ls-ctmc
   do
       LOOP=0
       while [ $LOOP -lt 6 ]
       do
           #snmpstat -S $SERVER public > /dev/null 2>&1
           ping $SERVER > /dev/null 2>&1
           RTN=$?
           if [ $RTN = 0 ]; then
               break
           elif [ ! -f message.$SERVER -a $LOOP -gt 0 ]; then
               #echo "ERROR: snmpstat failed on $SERVER ($LOOP) - `date`"
               echo "ERROR: ping failed on $SERVER ($LOOP) - `date`"
           fi
           LOOP=`expr $LOOP + 1`
           #sleep 10
       done

       # Check apache.
       LOOP=0
       while [ $LOOP -lt 6 ]
       do
           wget http://$SERVER/ > /dev/null 2>&1
           RTN=$?
           if [ $RTN = 0 ]; then
               break
           elif [ ! -f message.$SERVER.httpd -a $LOOP -gt 0 ]; then
               echo "ERROR: wget failed on $SERVER ($LOOP) - `date`"
           fi
           LOOP=`expr $LOOP + 1`
           sleep 10
       done

       if [ $RTN -ne 0 ]; then
           # Sleep an extra 60 seconds if server just came back up
           if [ -f WAIT.$SERVER ]; then
               rm WAIT.$SERVER
               continue
           fi
           if [ ! -f message.$SERVER.httpd ]; then
               SendMsg "Something is wrong with HTTPD on $SERVER"
$SERVER.httpd
           fi
       elif [ -f message.$SERVER.httpd ]; then
           SendMsg "HTTPD on $SERVER is ok now" $SERVER.httpd REMOVE
       fi
       rm index.html* 2> /dev/null
       rm WAIT.$SERVER 2> /dev/null

       # Check tomcat.
       CNT=`rsh $SERVER "psfind tomcat |grep native_threads |wc -l"`
       if [ $? = 0 ]; then
           if [ $CNT = 0 ]; then
               if [ ! -f message.$SERVER.tomcat -a ! -f
message.$SERVER.httpd ]; then
                   SendMsg "Something is wrong with TOMCAT on $SERVER"
$SERVER.tomcat
               fi
           elif [ -f message.$SERVER.tomcat ]; then
               SendMsg "TOMCAT on $SERVER is ok now" $SERVER.tomcat

REMOVE


           fi
       fi
   done

sleep 60

done

--mikej
-=-----
mike jackson
[EMAIL PROTECTED]


-----Original Message-----
From: tomcat guy [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 25, 2003 11:06 AM
To: Tomcat Users List
Subject: Script for checking remote server


What does everyone use to check the status of a remote server?


I am needing a script (or what have you) that will validate that
my Tomcat server is up and running on timed intervals.  If the
server is down, I need to post to a web page that sends either
(or both) an email & a msg to my cell phone (think I have this
part figured out).

Anyone care to share some code? Or offer some ideas?

It would be very much appreciated!
Thanks,
Chris



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to