背景:在使用linux时,经常会写一些linux命令片段,比较麻烦,有经验的程序员会把

这些碎片式的命令写成shell脚本

1.重启tomcat脚本

#!/bin/sh
#kill tomcat pid
pidlist=`ps -ef|grep tomcat|grep -v "grep"|awk '{print $2}'`
if [ "$pidlist" = "" ]
   then
       echo "no tomcat pid alive!"
else
  echo "tomcat Id list :$pidlist"
  kill -9 $pidlist
  echo "KILL $pidlist:"
  echo "service stop success"
fi
echo "start tomcat"
cd /usr/local/tomcat/bin
./startup.sh ;tail -f ../logs/catalina.out
~                                                                                                                                  
~

未完待续……

posted on 2015-10-24 16:33  程序那些事  阅读(293)  评论(0编辑  收藏  举报
http://www.cnblogs.com/weiguo21/p/5191887.html