diff options
Diffstat (limited to 'qpid/cpp')
| -rw-r--r-- | qpid/cpp/etc/CMakeLists.txt | 3 | ||||
| -rwxr-xr-x | qpid/cpp/etc/qpidd-primary.in | 39 | ||||
| -rwxr-xr-x | qpid/cpp/etc/qpidd.in | 10 |
3 files changed, 29 insertions, 23 deletions
diff --git a/qpid/cpp/etc/CMakeLists.txt b/qpid/cpp/etc/CMakeLists.txt index 6158b9e27b..c39257e6cc 100644 --- a/qpid/cpp/etc/CMakeLists.txt +++ b/qpid/cpp/etc/CMakeLists.txt @@ -19,11 +19,12 @@ if (UNIX) - # Use automake variable names as these files are also configured by automake. # Use absolute paths as these are substituted into init scripts. set_absolute_install_path (bindir ${QPID_INSTALL_BINDIR}) set_absolute_install_path (sysconfdir ${SYSCONF_INSTALL_DIR}) set_absolute_install_path (sbindir ${QPID_INSTALL_SBINDIR}) + set_absolute_install_path (initdir ${QPID_INSTALL_INITDDIR}) + set_absolute_install_path (confdir ${QPID_INSTALL_CONFDIR}) configure_file(qpidd.in ${CMAKE_CURRENT_BINARY_DIR}/qpidd diff --git a/qpid/cpp/etc/qpidd-primary.in b/qpid/cpp/etc/qpidd-primary.in index 64537b9b1d..377f2d623a 100755 --- a/qpid/cpp/etc/qpidd-primary.in +++ b/qpid/cpp/etc/qpidd-primary.in @@ -37,27 +37,28 @@ prog=qpidd -# Source function library. -. /etc/rc.d/init.d/functions +# The following variables can be overridden in @sysconfdir@/sysconfig/$prog +QPID_INIT=@initdir@/$prog +QPID_CONFIG=@confdir@/qpidd.conf +QPID_HA=@bindir@/qpid-ha +QPID_HA_OPTIONS="--config $QPID_CONFIG" -if [ -f @sysconfdir@/sysconfig/$prog ] ; then - . @sysconfdir@/sysconfig/$prog -fi +# Source configuration +test -f @sysconfdir@/sysconfig/$prog && source @sysconfdir@/sysconfig/$prog -# The following variables can be overridden in @sysconfdir@/sysconfig/$prog -[[ $QPID_PORT ]] || QPID_PORT=5672 -[[ $QPID_HA ]] || QPID_HA=@bindir@/qpid-ha -export QPID_PORT +# Check presence of executables/scripts +for f in $QPID_INIT $QPID_HA; do + test -x $f || { echo "$f not found or not executable"; exit 5; } +done -RETVAL=0 +QPID_HA="$QPID_HA $QPID_HA_OPTIONS" -#ensure binary is present and executable -if [[ !(-x $QPID_HA) ]]; then - echo "qpid-ha executable not found or not executable" -fi +source /etc/rc.d/init.d/functions + +RETVAL=0 status() { - if $QPID_HA -b localhost:$QPID_PORT status --is-primary ; then + if $QPID_HA status --is-primary ; then echo "qpidd is primary" else echo "qpidd is not primary" @@ -66,14 +67,14 @@ status() { } start() { - service qpidd start + $QPID_INIT start echo -n $"Promoting qpid daemon to cluster primary: " - $QPID_HA -b localhost:$QPID_PORT promote + $QPID_HA promote [ "$?" -eq 0 ] && success || failure } stop() { - service qpidd stop + $QPID_INIT stop } reload() { @@ -82,7 +83,7 @@ reload() { } restart() { - service qpidd restart && start + $QPID_INIT restart && start } # See how we were called. diff --git a/qpid/cpp/etc/qpidd.in b/qpid/cpp/etc/qpidd.in index b8d0e87038..55697492e4 100755 --- a/qpid/cpp/etc/qpidd.in +++ b/qpid/cpp/etc/qpidd.in @@ -39,6 +39,11 @@ prog=qpidd lockfile=/var/lock/subsys/$prog pidfile=/var/run/qpidd.pid +# The following variables can be overridden in @sysconfdir@/sysconfig/$prog +QPID_BIN=@sbindir@/$prog +QPID_CONFIG=@confdir@/qpidd.conf +QPID_DATA_DIR=/var/lib/qpidd + # Source configuration if [ -f @sysconfdir@/sysconfig/$prog ] ; then . @sysconfdir@/sysconfig/$prog @@ -63,9 +68,8 @@ if [ $RETVAL = 4 ]; then fi start() { - [[ $QPID_DATA_DIR ]] || QPID_DATA_DIR=/var/lib/qpidd echo -n $"Starting Qpid AMQP daemon: " - daemon --pidfile $pidfile --check $prog --user qpidd @sbindir@/$prog --data-dir $QPID_DATA_DIR --daemon $QPIDD_OPTIONS + daemon --pidfile $pidfile --check $prog --user qpidd $QPID_BIN --config $QPID_CONFIG --data-dir $QPID_DATA_DIR --daemon $QPIDD_OPTIONS RETVAL=$? echo [ $RETVAL = 0 ] && touch $lockfile @@ -73,7 +77,7 @@ start() { touch $pidfile chown qpidd.qpidd $pidfile [ -x /sbin/restorecon ] && /sbin/restorecon $pidfile - runuser - -s /bin/sh qpidd -c "@sbindir@/$prog --check > $pidfile" + runuser - -s /bin/sh qpidd -c "$QPID_BIN --check > $pidfile" fi return $RETVAL } |
