summaryrefslogtreecommitdiff
path: root/packaging/common
diff options
context:
space:
mode:
authorMichael Bridgen <mikeb@lshift.net>2009-10-05 15:31:53 +0100
committerMichael Bridgen <mikeb@lshift.net>2009-10-05 15:31:53 +0100
commite205a1f1873b19f9dfb4ec934da1b4ee91e461a2 (patch)
tree25f878eaf5a22fd1983a48cb09002a70ea631ab5 /packaging/common
parent88d5f01b0241679fed1b1032dfde1d4760eaeb9d (diff)
parent1ff98eb5204ee7edda8b85d74667e3d31e4bc5ac (diff)
downloadrabbitmq-server-git-e205a1f1873b19f9dfb4ec934da1b4ee91e461a2.tar.gz
Merge from default. Resolved some conflicts due to bool->boolean in
type specs, and a bad automerge in rabbit_reader.erl.
Diffstat (limited to 'packaging/common')
-rw-r--r--packaging/common/rabbitmq-asroot-script-wrapper53
-rw-r--r--packaging/common/rabbitmq-script-wrapper35
-rw-r--r--packaging/common/rabbitmq-server.init138
3 files changed, 224 insertions, 2 deletions
diff --git a/packaging/common/rabbitmq-asroot-script-wrapper b/packaging/common/rabbitmq-asroot-script-wrapper
new file mode 100644
index 0000000000..9ef59ad76b
--- /dev/null
+++ b/packaging/common/rabbitmq-asroot-script-wrapper
@@ -0,0 +1,53 @@
+#!/bin/bash
+## The contents of this file are subject to the Mozilla Public License
+## Version 1.1 (the "License"); you may not use this file except in
+## compliance with the License. You may obtain a copy of the License at
+## http://www.mozilla.org/MPL/
+##
+## Software distributed under the License is distributed on an "AS IS"
+## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+## License for the specific language governing rights and limitations
+## under the License.
+##
+## The Original Code is RabbitMQ.
+##
+## The Initial Developers of the Original Code are LShift Ltd,
+## Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
+##
+## Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
+## Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
+## are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
+## Technologies LLC, and Rabbit Technologies Ltd.
+##
+## Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+## Ltd. Portions created by Cohesive Financial Technologies LLC are
+## Copyright (C) 2007-2009 Cohesive Financial Technologies
+## LLC. Portions created by Rabbit Technologies Ltd are Copyright
+## (C) 2007-2009 Rabbit Technologies Ltd.
+##
+## All Rights Reserved.
+##
+## Contributor(s): ______________________________________.
+##
+
+# Escape spaces and quotes, because shell is revolting.
+for arg in "$@" ; do
+ # Escape quotes in parameters, so that they're passed through cleanly.
+ arg=$(sed -e 's/"/\\"/g' <<-END
+ $arg
+ END
+ )
+ CMDLINE="${CMDLINE} \"${arg}\""
+done
+
+cd /var/lib/rabbitmq
+
+SCRIPT=`basename $0`
+
+if [ `id -u` = 0 ] ; then
+ /usr/lib/rabbitmq/bin/${SCRIPT} ${CMDLINE}
+else
+ echo -e "\nOnly root should run ${SCRIPT}\n"
+ exit 1
+fi
+
diff --git a/packaging/common/rabbitmq-script-wrapper b/packaging/common/rabbitmq-script-wrapper
index 296a77d19c..0c4bd0a8d7 100644
--- a/packaging/common/rabbitmq-script-wrapper
+++ b/packaging/common/rabbitmq-script-wrapper
@@ -1,8 +1,39 @@
-#!/bin/bash
+#!/bin/sh
+## The contents of this file are subject to the Mozilla Public License
+## Version 1.1 (the "License"); you may not use this file except in
+## compliance with the License. You may obtain a copy of the License at
+## http://www.mozilla.org/MPL/
+##
+## Software distributed under the License is distributed on an "AS IS"
+## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+## License for the specific language governing rights and limitations
+## under the License.
+##
+## The Original Code is RabbitMQ.
+##
+## The Initial Developers of the Original Code are LShift Ltd,
+## Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
+##
+## Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
+## Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
+## are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
+## Technologies LLC, and Rabbit Technologies Ltd.
+##
+## Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+## Ltd. Portions created by Cohesive Financial Technologies LLC are
+## Copyright (C) 2007-2009 Cohesive Financial Technologies
+## LLC. Portions created by Rabbit Technologies Ltd are Copyright
+## (C) 2007-2009 Rabbit Technologies Ltd.
+##
+## All Rights Reserved.
+##
+## Contributor(s): ______________________________________.
+##
+
# Escape spaces and quotes, because shell is revolting.
for arg in "$@" ; do
# Escape quotes in parameters, so that they're passed through cleanly.
- arg=$(sed -e 's/"/\\"/' <<-END
+ arg=$(sed -e 's/"/\\"/g' <<-END
$arg
END
)
diff --git a/packaging/common/rabbitmq-server.init b/packaging/common/rabbitmq-server.init
new file mode 100644
index 0000000000..dc30597569
--- /dev/null
+++ b/packaging/common/rabbitmq-server.init
@@ -0,0 +1,138 @@
+#!/bin/sh
+#
+# rabbitmq-server RabbitMQ broker
+#
+# chkconfig: - 80 05
+# description: Enable AMQP service provided by RabbitMQ
+#
+
+### BEGIN INIT INFO
+# Provides: rabbitmq-server
+# Required-Start: $remote_fs $network
+# Required-Stop: $remote_fs $network
+# Default-Start:
+# Default-Stop:
+# Description: RabbitMQ broker
+# Short-Description: Enable AMQP service provided by RabbitMQ broker
+### END INIT INFO
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DAEMON=/usr/sbin/rabbitmq-multi
+NAME=rabbitmq-server
+DESC=rabbitmq-server
+USER=rabbitmq
+NODE_COUNT=1
+ROTATE_SUFFIX=
+INIT_LOG_DIR=/var/log/rabbitmq
+
+DEFAULTS_FILE= # This is filled in when building packages
+LOCK_FILE= # This is filled in when building packages
+
+test -x $DAEMON || exit 0
+
+# Include rabbitmq defaults if available
+if [ -f "$DEFAULTS_FILE" ] ; then
+ . $DEFAULTS_FILE
+fi
+
+RETVAL=0
+set -e
+
+start_rabbitmq () {
+ set +e
+ $DAEMON start_all ${NODE_COUNT} > ${INIT_LOG_DIR}/startup_log 2> ${INIT_LOG_DIR}/startup_err
+ case "$?" in
+ 0)
+ echo SUCCESS
+ [ -n "$LOCK_FILE" ] && touch $LOCK_FILE
+ RETVAL=0
+ ;;
+ 1)
+ echo TIMEOUT - check ${INIT_LOG_DIR}/startup_\{log,err\}
+ RETVAL=1
+ ;;
+ *)
+ echo FAILED - check ${INIT_LOG_DIR}/startup_log, _err
+ RETVAL=1
+ ;;
+ esac
+ set -e
+}
+
+stop_rabbitmq () {
+ set +e
+ status_rabbitmq quiet
+ if [ $RETVAL = 0 ] ; then
+ $DAEMON stop_all > ${INIT_LOG_DIR}/shutdown_log 2> ${INIT_LOG_DIR}/shutdown_err
+ RETVAL=$?
+ if [ $RETVAL = 0 ] ; then
+ # Try to stop epmd if run by the rabbitmq user
+ pkill -u rabbitmq epmd || :
+ [ -n "$LOCK_FILE" ] && rm -rf $LOCK_FILE
+ else
+ echo FAILED - check ${INIT_LOG_DIR}/shutdown_log, _err
+ fi
+ else
+ echo No nodes running
+ RETVAL=0
+ fi
+ set -e
+}
+
+status_rabbitmq() {
+ set +e
+ if [ "$1" != "quiet" ] ; then
+ $DAEMON status 2>&1
+ else
+ $DAEMON status > /dev/null 2>&1
+ fi
+ if [ $? != 0 ] ; then
+ RETVAL=1
+ fi
+ set -e
+}
+
+rotate_logs_rabbitmq() {
+ set +e
+ $DAEMON rotate_logs ${ROTATE_SUFFIX}
+ if [ $? != 0 ] ; then
+ RETVAL=1
+ fi
+ set -e
+}
+
+restart_rabbitmq() {
+ stop_rabbitmq
+ start_rabbitmq
+}
+
+case "$1" in
+ start)
+ echo -n "Starting $DESC: "
+ start_rabbitmq
+ echo "$NAME."
+ ;;
+ stop)
+ echo -n "Stopping $DESC: "
+ stop_rabbitmq
+ echo "$NAME."
+ ;;
+ status)
+ status_rabbitmq
+ ;;
+ rotate-logs)
+ echo -n "Rotating log files for $DESC: "
+ rotate_logs_rabbitmq
+ ;;
+ force-reload|reload|restart|condrestart|try-restart)
+ echo -n "Restarting $DESC: "
+ restart_rabbitmq
+ echo "$NAME."
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|status|rotate-logs|restart|condrestart|try-restart|reload|force-reload}" >&2
+ RETVAL=1
+ ;;
+esac
+
+exit $RETVAL