linux下监控进程脚本

2018-7-27 admin linux

#!/bin/sh
TARGET="/python -u main.py"
RUNFILE="./start.sh"
function check(){
    count=`ps -ef |grep "$1" |grep -v "grep" |wc -l`
    #echo $count
    if [ 0 == $count ];then
        echo "not exist....."
        $RUNFILE
    else
        echo "runing....."
    fi
}
check $TARGET
# 任务计划,每个5分钟执行
# */5 * * * * cd /opt/workdir && "./check.sh"

标签: Linux

发表评论:

Powered by emlog | |

浙ICP备17021512号 |浙公网安备 33010602008237号