Blob Blame History Raw
From 746092585eaeff60502901fe9f125304c61c3523 Mon Sep 17 00:00:00 2001
From: "Darryl L. Pierce" <mcpierce@gmail.com>
Date: Thu, 30 Jan 2014 09:23:56 -0500
Subject: [PATCH 02/10] NO-JIRA: SysVInit script for qdrouterd.

---
 etc/qdrouterd | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)
 create mode 100644 etc/qdrouterd

diff --git a/etc/qdrouterd b/etc/qdrouterd
new file mode 100644
index 0000000..2b3f1ed
--- /dev/null
+++ b/etc/qdrouterd
@@ -0,0 +1,86 @@
+#!/bin/bash
+#
+# /etc/rc.d/init.d/qdrouterd
+#
+# Startup script for the Qpid Router.
+#
+# <tags -- see below for tag definitions. *Every line* from the top
+# of the file to the end of the tags section must begin with a #
+# character. After the tags section, there should be a blank line.
+# This keeps normal comments in the rest of the file from being
+# mistaken for tags, should they happen to fit the pattern.>
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+### BEGIN INIT INFO
+# Provides: qdrouterd
+# Required-Start: $local_fs
+# Required-Stop: $local_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: start or stop qdrouterd
+# Description: Qpid Router is an intermediary for AMQP messaging.
+### END INIT INFO
+
+prog=qdrouterd
+exe=/usr/sbin/$prog
+lockfile=/var/lock/subsys/$prog
+pidfile=/var/run/$prog.pid
+config=/etc/qpid-dispatch/qdrouterd.conf
+
+if [ -f /etc/sysconfig/$prog ]; then
+    . /etc/sysconfig/$prog
+fi
+
+# ensure binary is present before continuing
+if [[ !(-x $exe) ]]; then
+    echo "$exe not found or is not executable"
+    exit 5
+fi
+
+start() {
+        echo -n "Starting qdrouterd services: "
+        $exe --daemon --pidfile $pidfile --user qpidd
+        RETVAL=$?
+        [ $RETVAL = 0 ] && touch $lockfile
+        if [ $RETVAL = 0 ]; then
+            touch $pidfile
+            chown qpidd.qpidd $pidfile
+            [ -x /sbin/restorecon ] && /sbin/restorecon $pidfile
+        fi
+}
+
+stop() {
+        echo -n "Shutting down qdrouterd services: "
+        killproc -p $pidfile $prog
+        RETVAL=$?
+        [ $RETVAL = 0 ] && rm -f $lockfile $pidfile
+}
+
+restart() {
+        stop
+        start
+}
+
+case "$1" in
+    start|stop|restart|reload)
+        $1
+        ;;
+
+    status)
+        status $prog
+        RETVAL=$?
+        ;;
+
+    force-reload)
+        restart
+        ;;
+
+    *)
+        echo "Usage: $0 {start|stop|status|restart|reload|status|force-reload}"
+        exit 2
+        ;;
+esac
+
+exit $RETVAL
-- 
2.1.0