无标题文档
人多不足以依赖,要生存只有靠自己。
      深窥自己的心,而后发觉一切的奇迹在你自己。
          凡事皆有终结,因此,耐心是赢得成功的一种手段。

Linux 重启Tomcat脚本

 

 

#!/bin/test_restart.sh #Author : Javen
#Desc : restart tomcat-test
 
tomcatpath="/home/local/testJaven/tomcat-test"
tomcatname="tomcat-test"
 
 
if [ $# -ne 1 ]; then
        ps -ef | grep java | grep ${tomcatpath};
        pid=$(ps -ef | grep java | grep ${tomcatpath} | awk '{print $2}')
else
        pid=$1
fi
 
echo -e "Before start ${tomcatpath}, should kill the same run, kill pid ${pid}, and will start new ${tomcatname}  \c"
kill -9 $pid
sleep 9
cd ${tomcatpath}/bin
./startup.sh

 

tomcatpath 为tomcat在服务器完整的路径
tomcatname 为tomcat目录的名称


如果执行提示没有权限 添加一下执行权限 chmod +x test_restart.sh 

posted @ 2016-04-25 18:12  酷玩时刻  阅读(675)  评论(0编辑  收藏  举报
友情链接:快递查询 快递查询