00001 #!/bin/sh 00002 # 00003 # Script to shutdown server 00004 # 00005 # Reading University 00006 # MSc in Network Centered Computing 00007 # a.weise - a.weise@reading.ac.uk - December 2005 00008 # 00009 echo "stopping server ...." 00010 name=start_server.py 00011 00012 # Find all servers 00013 server_pid=`ps -elf | egrep $name | egrep -v grep | awk '{ print $4 }'` 00014 00015 if [ "$server_pid" = "" ] 00016 then 00017 echo No server is running ! 00018 else 00019 /bin/kill -15 $server_pid 00020 server_pid=`ps -elf | egrep $name | egrep -v grep | awk '{ print $4 }'` 00021 if [ "$server_pid" = "" ] 00022 then 00023 echo server stopped 00024 else 00025 /bin/kill -9 $server_pid 00026 echo server killed 00027 fi 00028 fi