51Testing软件测试论坛

标题: shell 脚本, 重新 重启tomcat [打印本页]

作者: jone123    时间: 2015-12-10 14:17
标题: shell 脚本, 重新 重启tomcat
#!/bin/bash
pid=`ps -ef| grep tomcat |wc -l `

if [ "$pid" -gt 1 ]
then
echo "tomcat is running!"

echo " ##################### now will kill  tomcat ,wait .............!  ######################"

ps -ef |grep  tomcat|grep -v grep|awk ' {print  $2} ' |xargs kill -9
if [ $? -eq 0 ]
then
echo ".................."
echo ".................."
echo " kill tomcat success !"
fi

else
echo " tomcat is not running !"
echo "####################### now will be start tomcat , wait...........! #######################"

sh /usr/local/apache-tomcat-8/bin/startup.sh
if [ $? -eq 0 ]
then
echo  "Restart tomcat is success "
fi

fi






欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2