2011/05/14

Tomcat init.d script

For some reason allmost all the init.d scripts for starting and stoping tomcat just calls tomcat's startup.sh and shutdown.sh scripts. I am ok with that as far as they work. The startup script works just fine but when I want to restart or stop a tomcat instance, in most cases I have to just kill the process.

So what I need is a way to try stop tomcat with it's shutdown script, wait a little bit to see if tomcat shutdown and if not just kill the process. The script below does that exactly

It would be much better to have a pid file at start time and use that one and not try to figure out the pid from ps. Maybe next version.

3 comments:

  1. I made it use the PID file and made some other changes. The code is here: http://blog.botha.us/sarel/?p=101

    ReplyDelete
  2. Looks good, just wish it allowed multiple tomcats run. I am looking for a script that allows you to control a single tomcat instance while not detecting others that may be running on the system.

    ReplyDelete