Checking in initscript to run observer
Sapan Bhatia [Tue, 5 Aug 2014 03:42:21 +0000 (23:42 -0400)]
observer-initscript [new file with mode: 0644]

diff --git a/observer-initscript b/observer-initscript
new file mode 100644 (file)
index 0000000..d948eac
--- /dev/null
@@ -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