blob: d1466b2fc97d6dd6678cd30747ed43a71ad6f681 [file] [log] [blame]
#!/bin/bash
#
# observer Starts and stops Observer daemon
#
# Source function library.
. /etc/init.d/functions
[ -f /etc/sysconfig/xosobserver ] && . /etc/sysconfig/xosobserver
xosobserver=${NODEMANAGER-"python /opt/xos/xos-observer.py -d"}
prog="OpenCloud Observer"
pidfile=${PIDFILE-/var/run/xosobserver.pid}
RETVAL=0
function start() {
action $"Starting $prog: " daemon --pidfile=$pidfile --check=xosobserver $xosobserver "$@"
}
function stop() {
action $"Stopping $prog: " killproc -p $pidfile xosobserver
}
case "$1" in
start)
start $options
;;
stop)
stop
;;
status)
status -p $pidfile xosobserver
RETVAL=$?
;;
restart|reload)
shift
stop
start $options "$@"
;;
condrestart)
shift
[ -f ${pidfile} ] && { stop; start $options "$@"; }
;;
restartverbose)
shift
stop
$xosobserver $verboseoptions "$@"
;;
restartdebug)
shift
stop
echo "Restarting with $debugoptions $@ .."
$xosobserver $debugoptions "$@"
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|restartdebug [-d]}"
exit 1
;;
esac
exit $RETVAL