Process monitoring and restart

 

 

#!/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"
		#Add the calling process startup script here
		echo "ProcessName was started"
	be
       sleep 10	
  done

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326421886&siteId=291194637