blob: d1466b2fc97d6dd6678cd30747ed43a71ad6f681 [file] [log] [blame]
Sapan Bhatiaca9b4e22014-08-04 23:42:21 -04001#!/bin/bash
2#
3# observer Starts and stops Observer daemon
4#
5
6# Source function library.
7. /etc/init.d/functions
8
Scott Bakerb1a951d2015-02-19 13:24:52 -08009[ -f /etc/sysconfig/xosobserver ] && . /etc/sysconfig/xosobserver
Sapan Bhatiaca9b4e22014-08-04 23:42:21 -040010
11
Scott Bakerb1a951d2015-02-19 13:24:52 -080012xosobserver=${NODEMANAGER-"python /opt/xos/xos-observer.py -d"}
Sapan Bhatiaca9b4e22014-08-04 23:42:21 -040013prog="OpenCloud Observer"
Scott Bakerb1a951d2015-02-19 13:24:52 -080014pidfile=${PIDFILE-/var/run/xosobserver.pid}
Sapan Bhatiaca9b4e22014-08-04 23:42:21 -040015
16RETVAL=0
17
18function start() {
Scott Bakerb1a951d2015-02-19 13:24:52 -080019 action $"Starting $prog: " daemon --pidfile=$pidfile --check=xosobserver $xosobserver "$@"
Sapan Bhatiaca9b4e22014-08-04 23:42:21 -040020}
21
22function stop() {
Scott Bakerb1a951d2015-02-19 13:24:52 -080023 action $"Stopping $prog: " killproc -p $pidfile xosobserver
Sapan Bhatiaca9b4e22014-08-04 23:42:21 -040024}
25
26case "$1" in
27 start)
28 start $options
29 ;;
30 stop)
31 stop
32 ;;
33 status)
Scott Bakerb1a951d2015-02-19 13:24:52 -080034 status -p $pidfile xosobserver
Sapan Bhatiaca9b4e22014-08-04 23:42:21 -040035 RETVAL=$?
36 ;;
37 restart|reload)
38 shift
39 stop
40 start $options "$@"
41 ;;
42 condrestart)
43 shift
44 [ -f ${pidfile} ] && { stop; start $options "$@"; }
45 ;;
46 restartverbose)
47 shift
48 stop
Scott Bakerb1a951d2015-02-19 13:24:52 -080049 $xosobserver $verboseoptions "$@"
Sapan Bhatiaca9b4e22014-08-04 23:42:21 -040050 ;;
51 restartdebug)
52 shift
53 stop
54 echo "Restarting with $debugoptions $@ .."
Scott Bakerb1a951d2015-02-19 13:24:52 -080055 $xosobserver $debugoptions "$@"
Sapan Bhatiaca9b4e22014-08-04 23:42:21 -040056 ;;
57 *)
58 echo $"Usage: $0 {start|stop|status|restart|condrestart|restartdebug [-d]}"
59 exit 1
60 ;;
61esac
62
63exit $RETVAL