Check if a process is running using Bash

后端 未结 7 928
被撕碎了的回忆
被撕碎了的回忆 2020-12-19 18:53

I am trying to check if a process is running with the code below:

SERVICE=\"./yowsup/yowsup-cli\"
RESULT=`ps aux | grep $SERVICE`

if [ \"${RESULT:-null}\" =         


        
相关标签:
7条回答
  • 2020-12-19 19:36

    SERVICE="./yowsup/yowsup-cli"
    RESULT=`ps aux | grep $SERVICE|grep -v grep`
    
    if [ "${RESULT:-null}" = null ]; then
        echo "not running"
    else
        echo "running"
    fi

    0 讨论(0)
提交回复
热议问题