现在的位置: 首页 > 综合 > 正文

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

2013年09月10日 ⁄ 综合 ⁄ 共 796字 ⁄ 字号 评论关闭

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 

抱歉!评论已关闭.