tomcat開機啟動指令碼

dbasdk發表於2017-04-24
1、tomcat啟動指令碼有兩個不同的版本:
#!/bin/sh
#chmod +x 
#chkconfig --add 
# tomcat-amazon  
#
# chkconfig:   - 98 02
#
export JAVA_HOME=/usr/local/java/jdk1.6.0_45
suffix=amazon
prog=tomcat-$suffix
TOMCAT_HOME=/usr/local/tomcat-7.0.54Ajob
export $JAVA_HOME
start_tomcat=$TOMCAT_HOME/bin/startup.sh
stop_tomcat=$TOMCAT_HOME/bin/shutdown.sh
lockfile=/var/lock/subsys/$prog
start() {
    echo -n "Starting tomcat-amazon: "
    ${start_tomcat}
    retval=$?
    echo
    [ $retval -eq 0 ] && touch $lockfile
    return $retval
}


stop() {
    echo -n "Shutdown tomcat-amazon"
    ${stop_tomcat}
    retval=$?
    echo
    [ $retval -eq 0 ] && rm -f $lockfile
    return $retval
}


restart() {
    stop
    sleep 1
    start
}


reload() {
    restart
}


#how we were called


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


exit 0

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29734436/viewspace-2137849/,如需轉載,請註明出處,否則將追究法律責任。

相關文章