updated on Fri Jan 20 20:16:25 UTC 2012
[aur-mirror.git] / rabbitmq / rabbitmqctl
blob0c4bd0a8d75fe6d48d5f646a48f13e683e31496d
1 #!/bin/sh
2 ## The contents of this file are subject to the Mozilla Public License
3 ## Version 1.1 (the "License"); you may not use this file except in
4 ## compliance with the License. You may obtain a copy of the License at
5 ## http://www.mozilla.org/MPL/
6 ##
7 ## Software distributed under the License is distributed on an "AS IS"
8 ## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
9 ## License for the specific language governing rights and limitations
10 ## under the License.
12 ## The Original Code is RabbitMQ.
14 ## The Initial Developers of the Original Code are LShift Ltd,
15 ## Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
17 ## Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
18 ## Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
19 ## are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
20 ## Technologies LLC, and Rabbit Technologies Ltd.
22 ## Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
23 ## Ltd. Portions created by Cohesive Financial Technologies LLC are
24 ## Copyright (C) 2007-2009 Cohesive Financial Technologies
25 ## LLC. Portions created by Rabbit Technologies Ltd are Copyright
26 ## (C) 2007-2009 Rabbit Technologies Ltd.
28 ## All Rights Reserved.
30 ## Contributor(s): ______________________________________.
33 # Escape spaces and quotes, because shell is revolting.
34 for arg in "$@" ; do
35 # Escape quotes in parameters, so that they're passed through cleanly.
36 arg=$(sed -e 's/"/\\"/g' <<-END
37 $arg
38 END
40 CMDLINE="${CMDLINE} \"${arg}\""
41 done
43 cd /var/lib/rabbitmq
45 SCRIPT=`basename $0`
47 if [ `id -u` = 0 ] ; then
48 su rabbitmq -s /bin/sh -c "/usr/lib/rabbitmq/bin/${SCRIPT} ${CMDLINE}"
49 else
50 /usr/lib/rabbitmq/bin/${SCRIPT}
51 echo -e "\nOnly root should run ${SCRIPT}\n"
52 exit 1