shell 监控判断进程是否存在,如果不存在就重新启动脚本。

#!/bin/bash

while [ 1 ]

do

SendMail_is_exstit=$(ps -ef | grep "feed SendMail" | grep -v grep | wc -l)

if [ ${SendMail_is_exstit} == 0 ]

then

cd /var/www/sdkfeed/

./app/Console/cake SendMail

fi

sleep 60

done


你可能感兴趣的:(shell监控脚本是否存在)