Kill defunct nm procs in vservers when stopping.
authorFaiyaz Ahmed <faiyaza@cs.princeton.edu>
Wed, 17 Oct 2007 20:21:19 +0000 (20:21 +0000)
committerFaiyaz Ahmed <faiyaza@cs.princeton.edu>
Wed, 17 Oct 2007 20:21:19 +0000 (20:21 +0000)
nm.init

diff --git a/nm.init b/nm.init
index 5d6a33c..5ba44e8 100755 (executable)
--- a/nm.init
+++ b/nm.init
@@ -5,7 +5,6 @@
 # chkconfig: 3 86 26
 # description: Starts and stops Node Manager daemon
 #
-# $Id$
 
 # Source function library.
 . /etc/init.d/functions
@@ -44,6 +43,10 @@ stop()
     RETVAL=$?
     echo
     [ $RETVAL -eq 0 ] && rm -f ${lockfile} ${pidfile}
+    for i in $( vps aux | grep nm.py | awk '{print $2}' ); do
+        kill -9 $i
+    done
+
 }
 
 restart()
@@ -55,26 +58,26 @@ restart()
 
 case "$1" in
     start)
-       start
-       ;;
+    start
+    ;;
     stop)
-       stop
-       ;;
+    stop
+    ;;
     status)
-       status $nm
-       RETVAL=$?
-       ;;
+    status $nm
+    RETVAL=$?
+    ;;
     restart|reload)
-       restart
-       ;;
+    restart
+    ;;
     condrestart)
-       if [ -f ${pidfile} ] ; then
-           restart
-       fi
-       ;;
+    if [ -f ${pidfile} ] ; then
+        restart
+    fi
+    ;;
     *)
-       echo $"Usage: $0 {start|stop|restart|condrestart|status}"
-       exit 1
+    echo $"Usage: $0 {start|stop|restart|condrestart|status}"
+    exit 1
 esac
 
 exit 0