You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Slimane Amar <sa...@genigraph.fr> on 2003/10/06 12:30:41 UTC

Restart automatically Tomcat

Hi all,

I'm using Tomcat 4.1.24 et i want after it fails it restarts automatically
to have a high availability.

Is it possible with only Tomcat ?

Thanks

--------------------------------------------------
Slimane AMAR         Mail: samar@genigraph.fr
GENIGRAPH            URL : http://www.genigraph.fr
104, rue Castagnary  Tel : +33 01 45 33 64 63
F-75015 PARIS FRANCE Fax : +33 01 45 33 89 63
--------------------------------------------------


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


Re: Restart automatically Tomcat

Posted by sr...@g88.net.
>> I'm using Tomcat 4.1.24 et i want after it fails it restarts
>> automatically to have a high availability.

> [Assuming Unix]
> Way 1 - Set $CATALINA_PID before staarting tomcat. Then have a cron
> job run occasasionally to look at the value in the file pointed at
> by $CATALINA_PID.  If the process doesn't exist - start tomcat.

That's a good idea.  Another option (also assuming unix, and the
willingness to do a little bit of shell scripting) would be to add a
wrapper around tomcat's scripts.

The general idea is

  while true; do
    # using "run" because it blocks
    $CATALINA_HOME/bin/catalina.sh run
    if really_shutting_down; then
      # we're supposed to stop, so exit gracefully
      exit 0
    fi
  done

"really_shutting_down" implies that you'd need a shutdown wrapper with
some provision for allowing the `loop' script to determine whether a
shutdown was accidental or intentional.  You'd also want to have some
sort of check in place to prevent an infinite loop if tomcat was
started with a bad configuration file, or something of that nature.

There are probably other little details to work out, but that's the
basic idea.

-- 
Steve

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


Re: Restart automatically Tomcat

Posted by Tim Funk <fu...@joedog.org>.
Yes and no.

No - the tomcat people don't provide this functionality but you can do it 
yourself.

[Assuming Unix]
Way 1 - Set $CATALINA_PID before staarting tomcat. Then have a cron job run 
occasasionally to look at the value in the file pointed at by $CATALINA_PID. 
If the process doesn't exist - start tomcat.

Way 2 - Wrap wget (or other user agent here) in a command line shell. If wget 
fails for reason [fill in here] - use $CATALINA_PID to kill the process and 
restart

Way 3 - Figure out why tomcat fails and prevent that from occuring and don't 
worry about 1,2

-Tim

Slimane Amar wrote:

> Hi all,
> 
> 
> 
> I'm using Tomcat 4.1.24 et i want after it fails it restarts automatically
> 
> to have a high availability.
> 
> 
> 
> Is it possible with only Tomcat ?
> 
> 
> 
> Thanks


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