blob: d948eacea2701228d1fed58f92f70226390b3875 [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
9[ -f /etc/sysconfig/plstackobserver ] && . /etc/sysconfig/plstackobserver
10
11
12plstackobserver=${NODEMANAGER-"python /opt/planetstack/planetstack-backend.py -d"}
13prog="OpenCloud Observer"
14pidfile=${PIDFILE-/var/run/plstackobserver.pid}
15
16RETVAL=0
17
18function start() {
19 action $"Starting $prog: " daemon --pidfile=$pidfile --check=plstackobserver $plstackobserver "$@"
20}
21
22function stop() {
23 action $"Stopping $prog: " killproc -p $pidfile plstackobserver
24}
25
26case "$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 ;;
61esac
62
63exit $RETVAL