#/bin/bash #队列的守护进程 Date = `date +"%F-%H:%M:%S"` XMML = "/var/www/html/xiangmu" project= "src.plan" log = "RIZHI" num = `ps aux|grep ${project}|grep -V ‘grep‘|wc -l` if [$num -eq 1] then echo "${Date}队列进程ok" >>/var/log/${log}.log elif [$num -ge 2] then ps aux|grep ${project}|awk ‘{print $2}‘|xargs kill else echo "${log}-${Date}队列进程异常" >>/var/logs/${LogName}.log echo "${LogName}-重启队列中--" >>/var/logs/${LogName}.log cd $XMML /usr/bin/nohup /user/local/bin/php src.task.php $project >>/var/log/NohupLog/nohup_${project}.log 2>&1 & num = `ps aux | grep -w {project} | grep -v ‘grep‘ |wc -l` if [$num -eq 1] then echo "${log}-已经重启.." >>/var/logs/${log}.log else echo "${log}-失败.." >>/var/logs/${log}.log fi fi
原文地址:https://www.cnblogs.com/songyanan/p/10637333.html
时间: 2024-10-12 12:03:40