Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 69043 invoked from network); 25 Feb 2003 20:58:50 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 25 Feb 2003 20:58:50 -0000 Received: (qmail 14894 invoked by uid 97); 25 Feb 2003 21:00:30 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@nagoya.betaversion.org Received: (qmail 14887 invoked from network); 25 Feb 2003 21:00:29 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 25 Feb 2003 21:00:29 -0000 Received: (qmail 67350 invoked by uid 500); 25 Feb 2003 20:58:29 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 67336 invoked from network); 25 Feb 2003 20:58:28 -0000 Received: from daydream.stanford.edu (171.65.60.156) by daedalus.apache.org with SMTP; 25 Feb 2003 20:58:28 -0000 Received: from localhost (tomcat@localhost) by daydream.stanford.edu (8.11.6/8.11.6) with ESMTP id h1P9Qxb14846 for ; Tue, 25 Feb 2003 01:26:59 -0800 Date: Tue, 25 Feb 2003 01:26:58 -0800 (PST) From: Oscar Carrillo To: Tomcat Users List Subject: RE: Script for checking remote server In-Reply-To: <83F0258A9996D311B14200A0C98F173602F22F6E@aas-internet.aas.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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" > > > To: "Tomcat Users List" > > > 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