9ff0b46
#!/bin/bash
9ff0b46
##   The contents of this file are subject to the Mozilla Public License
9ff0b46
##   Version 1.1 (the "License"); you may not use this file except in
9ff0b46
##   compliance with the License. You may obtain a copy of the License at
9ff0b46
##   http://www.mozilla.org/MPL/
9ff0b46
##
9ff0b46
##   Software distributed under the License is distributed on an "AS IS"
9ff0b46
##   basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
9ff0b46
##   License for the specific language governing rights and limitations
9ff0b46
##   under the License.
9ff0b46
##
9ff0b46
##   The Original Code is RabbitMQ.
9ff0b46
##
9ff0b46
##   The Initial Developers of the Original Code are LShift Ltd,
9ff0b46
##   Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
9ff0b46
##
9ff0b46
##   Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
9ff0b46
##   Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
9ff0b46
##   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
9ff0b46
##   Technologies LLC, and Rabbit Technologies Ltd.
9ff0b46
##
9ff0b46
##   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
9ff0b46
##   Ltd. Portions created by Cohesive Financial Technologies LLC are
9ff0b46
##   Copyright (C) 2007-2009 Cohesive Financial Technologies
9ff0b46
##   LLC. Portions created by Rabbit Technologies Ltd are Copyright
9ff0b46
##   (C) 2007-2009 Rabbit Technologies Ltd.
9ff0b46
##
9ff0b46
##   All Rights Reserved.
9ff0b46
##
9ff0b46
##   Contributor(s): ______________________________________.
9ff0b46
##
9ff0b46
9ff0b46
# Escape spaces and quotes, because shell is revolting.
9ff0b46
for arg in "$@" ; do
9ff0b46
	# Escape quotes in parameters, so that they're passed through cleanly.
9ff0b46
	arg=$(sed -e 's/"/\\"/g' <<-END
9ff0b46
		$arg
9ff0b46
		END
9ff0b46
	)
9ff0b46
	CMDLINE="${CMDLINE} \"${arg}\""
9ff0b46
done
9ff0b46
9ff0b46
cd /var/lib/rabbitmq
9ff0b46
9ff0b46
SCRIPT=`basename $0`
9ff0b46
9ff0b46
if [ `id -u` = 0 ] ; then
9ff0b46
    /usr/lib/rabbitmq/bin/${SCRIPT} ${CMDLINE}
9ff0b46
else
9ff0b46
    echo -e "\nOnly root should run ${SCRIPT}\n"
9ff0b46
    exit 1
9ff0b46
fi
9ff0b46