----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

> Does anyone have a nice script to check Jserv is running, and if not
> restart it? Something to add to my crontab.

Chris,

I use the following script on my system, run as root, to detect an error
in the logs and restart apache gracefully.  I'm not very proud of the
script, and would prefer a way of restarting the JVM instead of the
whole server, so suggestions are welcome.

Duane Gran
http://www.spinweb.net -- Servlet Hosting

#!/bin/ksh

restart_cmd='/usr/local/apache/bin/apachectl graceful'
error_msg='java.lang.ArrayIndexOutOfBoundsException'
Date=`date +%D`
Time=`date +%T`

output=`tail -20 /usr/local/jserv/logs/jserv.log | grep $error_msg`
if [[ $output != "" ]]; then
  $restart_cmd                                  # restart web server
  echo "$Date $Time: Restarting server" >>
/usr/local/jserv/logs/serverCheck.log
fi


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to