例如:
linux服务重启shell/ target=_blank class=infotextkey>shell脚本,以tomcat服务为例:
#!/bin/sh
#kill tomcat pid
pidlist=`ps -ef|grep $tomcatpath |grep -v "grep"|awk '{print $2}'`
if [ "$pidlist" = "" ]
then
echo "no tomcat pid alive!"
else
echo "tomcat pid list : $pidlist"
echo "killing pidlist : $pidlist"
kill -9 $pidlist
echo "tomcat stopped successfully!"
sleep 1
fi
echo "now starting tomcat......"
cd $tomcatpath/bin
调用: