背景:在使用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 ~ ~
未完待续……