Sapan Bhatia | ca9b4e2 | 2014-08-04 23:42:21 -0400 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # observer Starts and stops Observer daemon |
| 4 | # |
| 5 | |
| 6 | # Source function library. |
| 7 | . /etc/init.d/functions |
| 8 | |
| 9 | [ -f /etc/sysconfig/plstackobserver ] && . /etc/sysconfig/plstackobserver |
| 10 | |
| 11 | |
Scott Baker | eaeabad | 2015-02-09 11:18:46 -0800 | [diff] [blame] | 12 | plstackobserver=${NODEMANAGER-"python /opt/xos/xos-observer.py -d"} |
Sapan Bhatia | ca9b4e2 | 2014-08-04 23:42:21 -0400 | [diff] [blame] | 13 | prog="OpenCloud Observer" |
| 14 | pidfile=${PIDFILE-/var/run/plstackobserver.pid} |
| 15 | |
| 16 | RETVAL=0 |
| 17 | |
| 18 | function start() { |
| 19 | action $"Starting $prog: " daemon --pidfile=$pidfile --check=plstackobserver $plstackobserver "$@" |
| 20 | } |
| 21 | |
| 22 | function stop() { |
| 23 | action $"Stopping $prog: " killproc -p $pidfile plstackobserver |
| 24 | } |
| 25 | |
| 26 | case "$1" in |
| 27 | start) |
| 28 | start $options |
| 29 | ;; |
| 30 | stop) |
| 31 | stop |
| 32 | ;; |
| 33 | status) |
| 34 | status -p $pidfile plstackobserver |
| 35 | 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 |
| 49 | $plstackobserver $verboseoptions "$@" |
| 50 | ;; |
| 51 | restartdebug) |
| 52 | shift |
| 53 | stop |
| 54 | echo "Restarting with $debugoptions $@ .." |
| 55 | $plstackobserver $debugoptions "$@" |
| 56 | ;; |
| 57 | *) |
| 58 | echo $"Usage: $0 {start|stop|status|restart|condrestart|restartdebug [-d]}" |
| 59 | exit 1 |
| 60 | ;; |
| 61 | esac |
| 62 | |
| 63 | exit $RETVAL |