进程监控及重启

 

 

#!/bin/sh
while:
  do
    proInfo = $(ps -ef|grep "ProcessName" |grep -v "grep")
    if ["$proInfo"] ; then
	   echo "ProcessName is running"
    else 
	    echo "ProcessName was stoped"
        echo " to start ProcessName"
		#此处添加调用进程启动脚本
		echo "ProcessName was started"
	fi
       sleep 10	
  done

 

你可能感兴趣的:(linux)