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

  

posted @ 2018-11-18 09:34  bigbigwood  阅读(180)  评论(0)    收藏  举报