From: Sapan Bhatia Date: Tue, 5 Aug 2014 03:42:21 +0000 (-0400) Subject: Checking in initscript to run observer X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;ds=sidebyside;h=ca9b4e2373f270481ea44a285e822af0715d54dd;p=plstackapi.git Checking in initscript to run observer --- diff --git a/observer-initscript b/observer-initscript new file mode 100644 index 0000000..d948eac --- /dev/null +++ b/observer-initscript @@ -0,0 +1,63 @@ +#!/bin/bash +# +# observer Starts and stops Observer daemon +# + +# Source function library. +. /etc/init.d/functions + +[ -f /etc/sysconfig/plstackobserver ] && . /etc/sysconfig/plstackobserver + + +plstackobserver=${NODEMANAGER-"python /opt/planetstack/planetstack-backend.py -d"} +prog="OpenCloud Observer" +pidfile=${PIDFILE-/var/run/plstackobserver.pid} + +RETVAL=0 + +function start() { + action $"Starting $prog: " daemon --pidfile=$pidfile --check=plstackobserver $plstackobserver "$@" +} + +function stop() { + action $"Stopping $prog: " killproc -p $pidfile plstackobserver +} + +case "$1" in + start) + start $options + ;; + stop) + stop + ;; + status) + status -p $pidfile plstackobserver + RETVAL=$? + ;; + restart|reload) + shift + stop + start $options "$@" + ;; + condrestart) + shift + [ -f ${pidfile} ] && { stop; start $options "$@"; } + ;; + restartverbose) + shift + stop + $plstackobserver $verboseoptions "$@" + ;; + restartdebug) + shift + stop + echo "Restarting with $debugoptions $@ .." + $plstackobserver $debugoptions "$@" + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|restartdebug [-d]}" + exit 1 + ;; +esac + +exit $RETVAL