tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oscar Carrillo <tom...@daydream.stanford.edu>
Subject RE: Script for checking remote server
Date Tue, 25 Feb 2003 09:26:58 GMT
I believe so. Found this example below of launching Apache by using cygwin
as a service. Looks pretty straight-forward.

Oscar

-----------------------------------
Running Apache for Cygwin as a Service

Apache on Cygwin can be invoked as a Windows NT or Windows 2000 service. 
Cygwin has its own cygrunsrv.exe facility to define, remove, start, and 
stop services as follows:

    * Installing Apache as a new Service

      Use the following statement to install httpd.exe as a new service:
      $ cygrunsrv -I service_name-p /usr/local/apache/bin/httpd.exe [-a 
arguments] \ [-e VAR=VALUE] [-t auto|manual] [-u user] [-w passwd]

      Where -a is used to pass command line arguments (such as -DFOO 
defines) to httpd.exe, and -e is used to pass environment variables. If 
necessary you may use the -t options to set the autostart configuration 
for the service. If you want the new service to run under a different 
userid, you will have to supply the -u and -w options.
    * Starting Apache as a Service

      After the new service is installed it can be started using the 
following command:
      $ cygrunsrv -S service_name

      Check your process table and global error_log file to ensure Apache 
has started without any major problems.
------------------------------------------------

 On Tue, 25 Feb 
2003, Turner, John wrote:

> 
> Can you run scripts in Cygwin without being logged in?  I didn't think so,
> but I am not that familiar with Cygwin, I only use it to run "XWin -query
> hostname". ;)
> 
> John
> 
> 
> > -----Original Message-----
> > From: Oscar Carrillo [mailto:tomcat@daydream.stanford.edu]
> > Sent: Tuesday, February 25, 2003 4:11 AM
> > To: Tomcat Users List
> > Subject: Re: Script for checking remote server
> > 
> > 
> > You could install cygwin. Then you can run this script,
> > and get to learn a few common Linux tools too :-)
> > 
> > Oscar
> > 
> > On Tue, 25 Feb 2003, 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" <mjackson@cdi-hq.com>
> > > To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
> > > 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
> > > > mjackson@cdi-hq.com
> > > >
> > > > > -----Original Message-----
> > > > > From: tomcat guy [mailto:tomcat@corridortechnology.com]
> > > > > 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: tomcat-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: 
> > tomcat-user-help@jakarta.apache.org
> > > >
> > > 
> > > 
> > > 
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message