码迷,mamicode.com
首页 > 系统相关 > 详细

linux 脚本--守护进程

时间:2019-04-01 16:59:48      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:htm   rgs   style   lse   grep   gre   bsp   task   --   

#/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

 

linux 脚本--守护进程

标签:htm   rgs   style   lse   grep   gre   bsp   task   --   

原文地址:https://www.cnblogs.com/songyanan/p/10637333.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!