启动
#!/bin/bash # Author:wanglan # Mail:1213242044@qq.com # Fuction:Tomcat Start/stop/restart script # Version:1.0 . /etc/init.d/functions TOMCAT_DIR="/usr/local/tomcat8" START="$TOMCAT_DIR/bin/startup.sh" PID=`ps aux | grep $TOMCAT_DIR/bin | grep java | awk '{print $2}'` sh "$START" >/dev/null if [ $? -eq 0 ];then action "start" /bin/true else action "failed" /bin/false fi
关闭
#!/bin/bash # Author:wanglan # Mail:1213242044@qq.com # Fuction:Tomcat Start/stop/restart script # Version:1.0 . /etc/init.d/functions TOMCAT_DIR="/usr/local/tomcat8" #SHUTDOWN="$TOMCAT_DIR/bin/shutdown.sh" PID=`ps aux | grep $TOMCAT_DIR/bin | grep java | awk '{print $2}'` kill -9 $PID >/dev/null if [ $? -eq 0 ];then action "stop" /bin/true else action "failed" /bin/false fi
重启
#!/bin/bash # Author:wanglan # Mail:1213242044@qq.com # Fuction:Tomcat Start/stop/restart script # Version:1.0 . /etc/init.d/functions TOMCAT_DIR="/usr/local/tomcat8" START="$TOMCAT_DIR/bin/startup.sh" PID=`ps aux | grep $TOMCAT_DIR/bin | grep java | awk '{print $2}'` kill -9 $PID && sh "$START" >/dev/null if [ $? -eq 0 ];then action "restart" /bin/true else action "failed" /bin/false fi