revised layout
[nodemanager.git] / initscripts / nm
diff --git a/initscripts/nm b/initscripts/nm
new file mode 100755 (executable)
index 0000000..61b7254
--- /dev/null
@@ -0,0 +1,82 @@
+#!/bin/bash
+#
+# $Id$
+# $URL$
+#
+# nm       Starts and stops Node Manager daemon
+#
+# chkconfig: 3 86 26
+# description: Starts and stops Node Manager daemon
+#
+
+# Source function library.
+. /etc/init.d/functions
+
+if [ -f /etc/sysconfig/NodeManager ]; then
+    . /etc/sysconfig/NodeManager
+fi
+
+nm=${NM-"python /usr/share/NodeManager/nm.py"}
+prog="Node Manager"
+options=${OPTIONS-"-d -s"}
+restartoptions=${RESTARTOPTIONS-"-d"}
+pidfile=${PIDFILE-/var/run/nm.pid}
+lockfile=${LOCKFILE-/var/lock/subsys/nm}
+RETVAL=0
+
+do_start()
+{
+    echo -n $"Starting $prog: "
+    daemon --check=nm $nm "$@"
+    RETVAL=$?
+    echo
+    [ $RETVAL -eq 0 ] && touch ${lockfile}
+    return $RETVAL
+}
+
+start()
+{
+    do_start $options
+}
+
+stop()
+{
+    echo -n $"Stopping $prog: "
+    killproc nm
+    RETVAL=$?
+    echo
+    [ $RETVAL -eq 0 ] && rm -f ${lockfile} ${pidfile}
+}
+
+restart()
+{
+    stop
+    do_start $restartoptions
+}
+
+
+case "$1" in
+    start)
+    start
+    ;;
+    stop)
+    stop
+    ;;
+    status)
+    status $nm
+    RETVAL=$?
+    ;;
+    restart|reload)
+    restart
+    ;;
+    condrestart)
+    if [ -f ${pidfile} ] ; then
+        restart
+    fi
+    ;;
+    *)
+    echo $"Usage: $0 {start|stop|restart|condrestart|status}"
+    exit 1
+esac
+
+exit 0