tomcat开机启动脚本

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

当前标题:tomcat开机启动脚本
本文来源:http://myzitong.com/article/peoids.html