X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=initscripts%2Fnm;h=13f30ed953fc50f2a5d3bee94ff1f3e6bd177565;hb=345211babf0b11c2313c5e3ab8fcd075b139dc08;hp=61b7254c972a81bf24c081a7ee28a4a691d183ed;hpb=505d267ea72023fd0fe91bda9074a94d71a19c74;p=nodemanager.git diff --git a/initscripts/nm b/initscripts/nm index 61b7254..13f30ed 100755 --- a/initscripts/nm +++ b/initscripts/nm @@ -1,82 +1,75 @@ #!/bin/bash # -# $Id$ -# $URL$ -# # nm Starts and stops Node Manager daemon # -# chkconfig: 3 86 26 +# chkconfig: 3 97 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 +[ -f /etc/sysconfig/nodemanager ] && . /etc/sysconfig/nodemanager -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 +# Wait for libvirt to finish initializing +sleep 10 -do_start() -{ - echo -n $"Starting $prog: " - daemon --check=nm $nm "$@" - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch ${lockfile} - return $RETVAL -} +options=${OPTIONS-"-d"} +# turn on verbosity +verboseoptions=${DEBUGOPTIONS-"-v -d"} +# debug mode is interactive, and has faster period +# run in deamon mode with service nm restardebug -d +debugoptions=${DEBUGOPTIONS-"-v -p 30 -r 15"} -start() -{ - do_start $options -} +nodemanager=${NODEMANAGER-"python /usr/share/NodeManager/nodemanager.py"} +prog="Node Manager" +pidfile=${PIDFILE-/var/run/nodemanager.pid} -stop() -{ - echo -n $"Stopping $prog: " - killproc nm - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && rm -f ${lockfile} ${pidfile} -} +RETVAL=0 -restart() -{ - stop - do_start $restartoptions +function start() { + action $"Starting $prog: " daemon --pidfile=$pidfile --check=nodemanager $nodemanager "$@" } +function stop() { + action $"Stopping $prog: " killproc -p $pidfile nodemanager +} case "$1" in start) - start - ;; + start $options + ;; stop) - stop - ;; + stop + ;; status) - status $nm - RETVAL=$? - ;; + status -p $pidfile nodemanager + RETVAL=$? + ;; restart|reload) - restart - ;; + shift + stop + start $options "$@" + ;; condrestart) - if [ -f ${pidfile} ] ; then - restart - fi - ;; + shift + [ -f ${pidfile} ] && { stop; start $options "$@"; } + ;; + restartverbose) + shift + stop + $nodemanager $verboseoptions "$@" + ;; + restartdebug) + shift + stop + echo "Restarting with $debugoptions $@ .." + $nodemanager $debugoptions "$@" + ;; *) - echo $"Usage: $0 {start|stop|restart|condrestart|status}" - exit 1 + echo $"Usage: $0 {start|stop|status|restart|condrestart|restartdebug [-d]}" + exit 1 + ;; esac -exit 0 +exit $RETVAL