#!/bin/bash
cwd=`pwd`
echo $cwd
module=$1


function stopserver()
{
    echo "Begin stop module $1..."
    for i in `ps -ef | grep -w $1/$1 | grep -v grep | awk '{print $2}'`
    do
        echo "$1 process $i"
        echo "kill -${2} $i"
        kill -${2} $i
    done
    echo "Stop module $1 End"
}

# stopserver $module 2
# sleep 3

stopserver central 9
stopserver logic 9
stopserver world 9
stopserver gateway 9
stopserver mapsearch 9
stopserver fight 9
stopserver chat 9
stopserver login 9
stopserver gm 9
sleep 2
ps -ef | grep central
ps -ef | grep logic
ps -ef | grep world
ps -ef | grep fight
ps -ef | grep mapsearch
ps -ef | grep gateway
ps -ef | grep chat
ps -ef | grep login
ps -ef | grep gm
