首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

基准后台程序kill 重启脚本

2012-11-20 
标准后台程序kill 重启脚本.详见附件.#!/bin/bashchecktime6filterNum5proc_nameparticularImgMaini0w

标准后台程序kill 重启脚本.
详见附件.
#!/bin/bash
checktime=6
filterNum=5
proc_name=particularImgMain
i=0
while [ $i -lt $filterNum ]
do
        res=$(ps aux|grep $proc_name|grep -v grep)
        pid=$(echo $res |  awk '{print $2}')
kill $pid
while [ 1 ]
do
str=$(ps aux|grep $proc_name|grep $pid|grep -v grep)
if [ ! "$str" ]
then
echo "$pid killed successfully"
break
fi
        echo "wait kill $pid $i, sleep $checktime sec"
        sleep $checktime
done
        let "i=i+1"
done

热点排行