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