Here is what I have (I have removed and added some info to the output to make it a 
little more understandable):

File: -rwxr-xr-x    1 root     root  /etc/init.d/tomcatd

#!/bin/bash
#
#
# description: Startup script for Tomcat server
#

# source function library
. /etc/init.d/functions

CLASSPATH="$CLASSPATH:/usr/java/j2sdk1.4.0_03"
JAVA_HOME="/usr/java/j2sdk1.4.0_03"
CATALINA_HOME="/home/tomcat"

export CLASSPATH JAVA_HOME CATALINA_HOME

RETVAL=0

start()
{
        echo -n "Starting tomcat service: "
        su -m -c "$CATALINA_HOME/bin/startup.sh" - tomcat_admin
}

stop() {
        echo -n "Shutting down tomcat service: "
        su -m -c "$CATALINA_HOME/bin/shutdown.sh" - tomcat_admin
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart|reload)
        stop
        start
        ;;
  *)
        echo "Usage: tomcatd {start|stop|restart}"
        exit 1
esac

exit $RETVAL

For the above script to work, the tomcat directory structure is owned by tomcat_admin
drwxr-xr-x  tomcat_admin tomcat_admin    /home/tomcat

Then I created links as such:

lrwxrwxrwx    1 root     root     /etc/rc.d/rc0.d/K99tomcatd -> ../init.d/tomcatd
lrwxrwxrwx    1 root     root     /etc/rc.d/rc1.d/K99tomcatd -> ../init.d/tomcatd
lrwxrwxrwx    1 root     root     /etc/rc.d/rc2.d/S99tomcatd -> ../init.d/tomcatd
lrwxrwxrwx    1 root     root     /etc/rc.d/rc3.d/S99tomcatd -> ../init.d/tomcatd
lrwxrwxrwx    1 root     root     /etc/rc.d/rc4.d/S99tomcatd -> ../init.d/tomcatd
lrwxrwxrwx    1 root     root     /etc/rc.d/rc5.d/S99tomcatd -> ../init.d/tomcatd
lrwxrwxrwx    1 root     root     /etc/rc.d/rc6.d/K99tomcatd -> ../init.d/tomcatd

Some of these may not be needed, just put them there cause I could
If I do a reboot as opposed to a shut down, it calls rc6 stops (unsure if it also 
calls rc0 stops)

> -----Original Message-----
> From: Simone Chiaretta [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, February 16, 2003 1:04 PM
> To: Tomcat User List
> Subject: Startup/shutdown script
> 
> 
> Hello All,
> I'm using tomcat 4.0.4 on a linux (red hat 7.3) server
> I've a problem shutting down the tomcat deamon when the machine is
> stopped/rebooted from maintenance.
> The problem is that during the shutdown the shutdown script 
> (the script I'm
> referring to is the one below, not the shutdown.sh inside 
> tomcat bin dir) is
> not executed (or, at least, it doesn't write to the console 
> "Shutting down
> tomcat [OK]" nor write it to the boot.log nor messages and 
> also doesn't
> write to the catalina.out file the fact that tomcat was shut down.
> 
> If I execute the script at cmd line, the script shuts down 
> the process....
> Does anybody has a clue of what the problem could be?
> Thank you
> Simone
>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to