[rabbitmq-discuss] init script

Greg Swallow gswallow at exacttarget.com
Mon Mar 28 14:37:23 BST 2011


Hi,

I have questions about the init script.  I'm working with the version here:

http://hg.rabbitmq.com/rabbitmq-server/file/rabbitmq_v2_4_0/packaging/common/rabbitmq-server.init

I modified it a bit.  See below.  Specifically, I am curious about what this "$CONTROL wait > /dev/null 2>&1" line is.  I tried running "rabbitmqctl wait" and got an error back out of rabbitmqctl.  Am I missing something in my install?

Thanks.

--- rabbitmq-server.init.orig   2011-03-28 09:29:10.000000000 -0400
+++ rabbitmq-server.init        2011-03-28 09:32:47.000000000 -0400
@@ -16,16 +16,17 @@
 # Short-Description: Enable AMQP service provided by RabbitMQ broker
 ### END INIT INFO

-PATH=/sbin:/usr/sbin:/bin:/usr/bin
+PREFIX_DIR=/opt/rabbitmq/rabbitmq-2.4.0
+PATH=${PREFIX_DIR}/sbin:/sbin:/sbin:/usr/sbin:/bin:/usr/bin
 NAME=rabbitmq-server
 DAEMON=/usr/sbin/${NAME}
 CONTROL=/usr/sbin/rabbitmqctl
 DESC=rabbitmq-server
-USER=rabbitmq
+RUNAS_USER=rabbitmq
 ROTATE_SUFFIX=
 INIT_LOG_DIR=/var/log/rabbitmq
-
-LOCK_FILE= # This is filled in when building packages
+HOME=/var/lib/rabbitmq
+LOCK_FILE=/var/lock/rabbitmq.pid

 test -x $DAEMON || exit 0

@@ -41,7 +42,6 @@
         set +e
         setsid sh -c "$DAEMON > ${INIT_LOG_DIR}/startup_log \
             2> ${INIT_LOG_DIR}/startup_err" &
-        $CONTROL wait >/dev/null 2>&1
         RETVAL=$?
         set -e
         case "$RETVAL" in
@@ -101,7 +101,7 @@
     set -e
 }

-restart_running_rabbitmq () {
+restart_running_rabbitmq() {
     status_rabbitmq quiet
     if [ $RETVAL = 0 ] ; then
         restart_rabbitmq
@@ -116,6 +116,15 @@
     start_rabbitmq
 }

+become_rabbitmq() {
+    if [ "$USER" != "$RUNAS_USER" ]; then
+       su $RUNAS_USER -c "$*"
+       exit 0;
+    fi
+}
+
+become_rabbitmq $0 $*
+
 case "$1" in
     start)
         echo -n "Starting $DESC: "



ExactTarget
Greg Swallow
System Administrator
Phone | 317 524-5250
Yahoo IM | gswallow01
Email  | gswallow at exacttarget.com<mailto:gswallow at exacttarget.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110328/7fbe2007/attachment.htm>


More information about the rabbitmq-discuss mailing list