#!/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 [ -f /etc/sysconfig/NodeManager ] && . /etc/sysconfig/NodeManager options=${OPTIONS-"-d -s"} restartoptions=${RESTARTOPTIONS-"-d"} # turn on verbosity verboseoptions=${DEBUGOPTIONS-"-v -d"} # debug mode is interactive, and has faster period debugoptions=${DEBUGOPTIONS-"-v -p 30 -r 15"} nm=${NM-"python /usr/share/NodeManager/nm.py"} prog="Node Manager" pidfile=${PIDFILE-/var/run/nm.pid} lockfile=${LOCKFILE-/var/lock/subsys/nm} RETVAL=0 function start() { echo -n $"Starting $prog: " daemon --check=nm $nm "$@" RETVAL=$? echo [ $RETVAL -eq 0 ] && touch ${lockfile} return $RETVAL } function stop() { echo -n $"Stopping $prog: " killproc nm RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f ${lockfile} ${pidfile} } case "$1" in start) start $options ;; stop) stop ;; status) status $nm RETVAL=$? ;; restart|reload) shift stop start $restartoptions "$@" ;; condrestart) shift [ -f ${pidfile} ] && { stop; start $restartoptions "$@"; } ;; restartverbose) shift stop $nm $verboseoptions "$@" ;; restartdebug) shift stop echo "Restarting with $debugoptions $@ .." $nm $debugoptions "$@" ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|restartdebug [-d]}" exit 1 ;; esac exit $RETVAL