判断进程自动启动的脚本(error)

来源:互联网 发布:网络社交的利与弊作文 编辑:程序博客网 时间:2024/05/05 13:15

encash_thread_mon.sh

#!/bin/bash
a=`ps -elf|grep com.zhcw.h8.encashCenter.EncashThread |grep -v grep|wc -l`
echo $a
if [ $a -gt 0 ]
then
  echo `date` "happy8 is running....">/tmp/log.txt
else
    echo `date` "happy8 is start ...">/tmp/log.txt
    ps -ax|grep com.zhcw.h8.encashCenter.EncashThread |awk '{print $1}'|xargs kill -9
    cd /opt/oias/h8/scripts
    nohup  ./encash_thread.sh &
fi
****************************************************
1-59 * * * * cd /opt/oias/h8/scripts; ./delivery_center.sh

delivery_center_mon.sh

#!/bin/bash
a=`ps -elf|grep com.zhcw.h8.deliveryCenter.Control |grep -v grep|wc -l`
echo $a
if [ $a -gt 0 ]
then
  echo `date` "happy8 is running....">/tmp/log.txt
else
    echo `date` "happy8 is start ...">/tmp/log.txt
    ps -ax|grep com.zhcw.h8.deliveryCenter.Control |awk '{print $1}'|xargs kill -9
    cd /opt/oias/h8/scripts
    nohup    ./delivery_center.sh &
fi 

原创粉丝点击