X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=initscripts%2Fnm;h=13f30ed953fc50f2a5d3bee94ff1f3e6bd177565;hb=345211babf0b11c2313c5e3ab8fcd075b139dc08;hp=25b3c2653b12ba0d175c7dfc3a9688c256748b56;hpb=cdf5b60300c018790d27e6ec8b3e781f996ea687;p=nodemanager.git diff --git a/initscripts/nm b/initscripts/nm index 25b3c26..13f30ed 100755 --- a/initscripts/nm +++ b/initscripts/nm @@ -1,84 +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 + +# Wait for libvirt to finish initializing +sleep 10 -nm=${NM-"python /usr/share/NodeManager/nm.py"} +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"} + +nodemanager=${NODEMANAGER-"python /usr/share/NodeManager/nodemanager.py"} prog="Node Manager" -options=${OPTIONS-"-d -s"} -restartoptions=${RESTARTOPTIONS-"-d"} -# debug mode is interactive, and has faster period -debugoptions=${DEBUGOPTIONS-"-v -p 60 -r 31"} -pidfile=${PIDFILE-/var/run/nm.pid} -lockfile=${LOCKFILE-/var/lock/subsys/nm} -RETVAL=0 +pidfile=${PIDFILE-/var/run/nodemanager.pid} -do_start() -{ - echo -n $"Starting $prog: " - daemon --check=nm $nm "$@" - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch ${lockfile} - return $RETVAL -} +RETVAL=0 -start() -{ - do_start $options +function start() { + action $"Starting $prog: " daemon --pidfile=$pidfile --check=nodemanager $nodemanager "$@" } -stop() -{ - echo -n $"Stopping $prog: " - killproc nm - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && rm -f ${lockfile} ${pidfile} +function stop() { + action $"Stopping $prog: " killproc -p $pidfile nodemanager } case "$1" in start) - start + start $options ;; stop) stop ;; status) - status $nm + status -p $pidfile nodemanager RETVAL=$? ;; restart|reload) + shift stop - do_start $restartoptions + start $options "$@" + ;; + condrestart) + shift + [ -f ${pidfile} ] && { stop; start $options "$@"; } + ;; + restartverbose) + shift + stop + $nodemanager $verboseoptions "$@" ;; restartdebug) shift stop - [[ -z "$@" ]] && echo "Running interactively .." - $nm $debugoptions "$@" + echo "Restarting with $debugoptions $@ .." + $nodemanager $debugoptions "$@" ;; - condrestart) - if [ -f ${pidfile} ] ; then - restart - fi - ;; *) - echo $"Usage: $0 {start|stop|restart|condrestart|status|restartdebug [-d]}" - exit 1 + echo $"Usage: $0 {start|stop|status|restart|condrestart|restartdebug [-d]}" + exit 1 + ;; esac -exit 0 +exit $RETVAL