log slice name where applicable before traceback.
[nodemanager.git] / nm.init
diff --git a/nm.init b/nm.init
index d97c215..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: vnet.init,v 1.21 2006/02/27 15:41:27 mlhuang Exp $
 
 # Source function library.
 . /etc/init.d/functions
@@ -16,13 +15,14 @@ fi
 
 nm=${NM-"python /usr/share/NodeManager/nm.py"}
 prog="Node Manager"
-options=${OPTIONS-"-d -s"}
+restartoptions=
 pidfile=${PIDFILE-/var/run/nm.pid}
 lockfile=${LOCKFILE-/var/lock/subsys/nm}
 RETVAL=0
 
-start()
+do_start()
 {
+    options=$1
     echo -n $"Starting $prog: "
     daemon --check=nm $nm $options
     RETVAL=$?
@@ -31,6 +31,11 @@ start()
     return $RETVAL
 }
 
+start()
+{
+    do_start ${OPTIONS-"-d -s"}
+}
+
 stop()
 {
     echo -n $"Stopping $prog: "
@@ -38,32 +43,41 @@ 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()
+{
+    stop
+    do_start ${OPTIONS-"-d"}
+}
+
+
 case "$1" in
     start)
-       start
-       ;;
+    start
+    ;;
     stop)
-       stop
-       ;;
+    stop
+    ;;
     status)
-       status $nm
-       RETVAL=$?
-       ;;
+    status $nm
+    RETVAL=$?
+    ;;
     restart|reload)
-       stop
-       start
-       ;;
+    restart
+    ;;
     condrestart)
-       if [ -f ${pidfile} ] ; then
-           stop
-           start
-       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