On Mon, Dec 16, 2002 at 11:56:56AM -0500 or thereabouts, Peter wrote:
> How can I add tomcat to "Services" on a Red HAt 8.0 linux system, just like apache?
> 
> I know I can add a line to /etc/rc.d/init.d/httpd to start it at bootup, but I'd 
>like to have it show up under "Services", so I can stop and restart when I need it.
> 

I recently created this script to use tomcat as a service.  Hope this helps.

#       This is the init script for starting up the 
#               Jakarta Tomcat server
#
# chkconfig: 345 50 50 
# description: Starts and stops the Tomcat daemon.
#

# Source function library.
. /etc/rc.d/init.d/functions

# Get config.
. /etc/sysconfig/network

# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0

tomcat=/usr/local/jakarta/tomcat
startup=$tomcat/bin/startup.sh
shutdown=$tomcat/bin/shutdown.sh
export JAVA_HOME=/usr/local/java/j2sdk1.4.1

start(){
        echo -n $"Starting Tomcat service: " 
        # Change to tomcat user to start server. Don't run as root.
        daemon su tomcat -c $startup
        RETVAL=$?
        echo
}

stop(){
        action $"Stopping Tomcat service: " $shutdown   
        RETVAL=$?
        echo
}

restart(){
    stop
    start
}


# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        # This doesn't work ;)
        status tomcat
        ;;
  restart)
        restart
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|restart}"
        exit 1
esac

exit 0

-- 
Andrew Pasquale



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to