Adding tomcat to the service under Linux

 
#!/bin/sh
# chkconfig: 2345 10 90
# description: tomcat service for ....
#Save this file to /etc/rc.d/init.d/
#The file name of this file is the name of the service to be registered, for example, the file name is saved as: tom-ctms
#The command used is: service tom-ctms start/stop/restart
#Add boot: chkconfig --add tom-ctms

. /etc/rc.d/init.d/functions

prog=centerumms
tomDir=/usr/apache-tomcat-6.0.33/
start()
{
        ${tomDir}bin/startup.sh
        action $"Starting $prog: " /bin/true
}

stop()
{
        kill -9 `ps -ef | grep $ {tomDir} | grep java | awk '{print $ 2}' `
        action $"Stopping $prog: " /bin/true
}


case "$1" in
start)
        start
;;
stop)
        stop
;;
restart)
                stop
                sleep 3
                start
;;
*)
                echo "Usage: /etc/init.d/${prog}d {start|stop|restart}"
esac
 
 
 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326587908&siteId=291194637