sh [检查进程是否正在运行] #process #test #command

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh [检查进程是否正在运行] #process #test #command相关的知识,希望对你有一定的参考价值。

#!/bin/bash
ps_out=`ps -ef | grep $1 | grep -v 'grep' | grep -v $0`
result=$(echo $ps_out | grep "$1")
if [[ "$result" != "" ]];then
    echo "Running"
else
    echo "Not Running"
fi

以上是关于sh [检查进程是否正在运行] #process #test #command的主要内容,如果未能解决你的问题,请参考以下文章