Shell 判断进程是否存在

# 判断是否启动了Redis,仅作为提醒
REDIS_PIDS=$(ps -ef | grep redis | grep -v grep | awk ‘{print $2}‘)
if [ "$REDIS_PIDS" = "" ]; then
    Echo_Yellow "Redis is not runing."
    #运行进程
fi

相关推荐