编写Linux脚本下载
以下是重启Linux下某进程的shell脚本,以tomcat进程为例:
#!/bin
pid=`ps -ef|grep tomcat|grep -v grep|awk '{print $2}'`
if [ “$pid” = “” ] ; then
echo “tomcat service does not start!”
else
kill -9 $pid
pid1=`ps -ef|grep tomcat|grep -v grep|awk '{print $2}'`
if [ “$pid1” = “” ] ; then
echo “Successfully kill tomcat processes: ” $pid
else
echo “tomcat kill process failed!”
exit 1
fi
fi
rm -rf /opt/tomcat/work/*
./startup.sh
pid2=`ps -ef|grep tomcat|grep -v grep|awk '{print $2}'`
if [ “$pid2” = “” ] ; then
echo “tomcat service failed to start!”
else
echo “tomcat service starts successfully:” $pid2
fi
本文来自系统大全为您分享如需转载请注明!推荐win10下载
下载仅供下载体验和测试学习,不得商用和正当使用。