paulwong

TOMCAT重启/启动/停止脚本


#!/bin/bash
#tomcat start script
# ./tomcat_start.sh start|restart|stop

RETVAL=0

start() {
 echo -n "Tomcat Starting"
 echo

 /root/java/apache-tomcat-7.0.47/bin/startup.sh
}

stop() {
 echo -n "Tomcat Stop"
 echo " port "$1
 if [ ! "$1" ];then
   echo "Usage port "
   exit 1
 fi
 pid=`netstat -tpln|grep $1 | awk '{print $7}' | awk -F/ '{print $1}'`

 if [ -n "$pid" ];then
    echo $pid
   echo "kill -9 pid "$pid
   kill -9 $pid
 fi

}

restart() {
 echo -n "Tomcat restart"
 echo
 stop $1
 start
}

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

exit $RETVAL

posted on 2015-06-24 10:21 paulwong 阅读(761) 评论(0)  编辑  收藏 所属分类: TOMCAT


只有注册用户登录后才能发表评论。


网站导航: