fixed start-rest.sh to correctly kill child processes
diff --git a/start-rest.sh b/start-rest.sh
index 564eccf..01e7638 100755
--- a/start-rest.sh
+++ b/start-rest.sh
@@ -11,6 +11,16 @@
REST_LOG="${LOGDIR}/rest.`hostname`.log"
#######################
+dokill() {
+ for cpid in $(ps -o pid= --ppid $1)
+ do
+ dokill $cpid
+ done
+ echo "killing: $(ps -p $1 -o cmd=)"
+ kill -9 $1 > /dev/null 2>&1
+}
+
+
function lotate {
logfile=$1
nr_max=${2:-10}
@@ -28,15 +38,16 @@
pids=`ps -edalf |grep ${script_name} | grep python | grep -v grep | awk '{print $4}'`
for p in ${pids}; do
if [ x$p != "x" ]; then
- sudo kill -KILL $p
- echo "Killed existing prosess (pid: $p)"
+ dokill $p
+# sudo kill -KILL $p
+# echo "Killed existing prosess (pid: $p)"
fi
done
}
function status {
nr_process=`ps -edalf |grep ${script_name} | grep python | grep -v grep | wc -l`
- if [ x${nr_process} != "x" ] ; then
+ if [ ${nr_process} != 0 ] ; then
echo "rest server is running"
else
echo "rest server is not running"