Linux运维命令

查找pid的进程号:  ps -ef | grep nginx | grep -v grep | awk '{print $2}'

#!/bin/sh

. ./common-env.sh

shutdownService(){
    # Find the service process id
    sid=`ps -ef | grep $1 | grep -v grep | awk '{print $2}'`

    if [ -n "${sid}" ]; then
        echo "Shutdown $1"
        kill ${sid}
    else
        echo "$1 not found"
    fi
}

# Shut down all services
for service in ${oxx_services[*]}
do
   shutdownService ${service}
done

  

猜你喜欢

转载自www.cnblogs.com/bigbigwood/p/9977036.html