本文来自系统大全为您提供如需转载请注明!推荐win10下载
编写Linux脚本
以下是重启Linux下某进程的shell脚本,以tomcat进程为例:#!/binpid=`ps-ef|greptomcat|grep-vgrep|awk'{print$2}'`if["$pid"=""];thenecho"tomcatservicedoesnotstart!"elsekill-9$pidpid1=`ps-ef|greptomcat|grep-vgrep|awk'{print$2}'`if["$pid1"=""];thenecho"Successfullykilltomcatprocesses:"$pidelseecho"tomcatkillprocessfailed!"exit1fifirm-rf/opt/tomcat/work/*./startup.shpid2=`ps-ef|greptomcat|grep-vgrep|awk'{print$2}'`if["$pid2"=""];thenecho"tomcatservicefailedtostart!"elseecho"tomcatservicestartssuccessfully:"$pid2fi

