1.先建立所要刪除的清單於 killlist內

2.建立一script內容如下,權限為755

#!/bin/bash

cat killlist | while read LINE

do
        PID=`ps aux | grep server | awk '{print $2 "\t" $11}' | grep $LINE | awk '{print $1}'`

        if [ ! -z $PID ]; then
                    kill -9 $PID
        fi

        PIDFILE=/var/run/$LINE.pid
        if [ -f $PIDFILE ]; then
                rm -rf $PIDFILE
        fi
done

ps aux | grep server

neo2124 發表在 痞客邦 PIXNET 留言(0) 人氣()