PageRenderTime 51ms CodeModel.GetById 48ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/bin/apiary_setup_rabbitmq.sh

https://bitbucket.org/lindenlab/apiary/
Shell | 64 lines | 27 code | 12 blank | 25 comment | 5 complexity | 8e7776520ae09e56b98c43bae3e242ce MD5 | raw file
 1#!/bin/bash
 2#
 3# $LicenseInfo:firstyear=2010&license=mit$
 4# 
 5# Copyright (c) 2010, Linden Research, Inc.
 6# 
 7# Permission is hereby granted, free of charge, to any person obtaining a copy
 8# of this software and associated documentation files (the "Software"), to deal
 9# in the Software without restriction, including without limitation the rights
10# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11# copies of the Software, and to permit persons to whom the Software is
12# furnished to do so, subject to the following conditions:
13# 
14# The above copyright notice and this permission notice shall be included in
15# all copies or substantial portions of the Software.
16# 
17# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23# THE SOFTWARE.
24# $/LicenseInfo$
25#
26
27
28if [ $EUID != 0 ]
29then
30    echo "You must be root to set up rabbitmq."
31    exit 1
32fi
33
34RMQCTL=rabbitmqctl
35
36if [ -z "`which $RMQCTL`" ]
37then
38    echo "$RMQCTL not found in your path.  Make sure that rabbitmq is installed and that your path is correct."
39    exit 1
40fi
41
42VERSION=$($RMQCTL status | grep RabbitMQ | cut -d ',' -f 4 | sed 's/["}]//g')
43
44if [ -z "$VERSION" ]
45then
46
47    echo "Error retrieving rabbitmq version.  Is the rabbitmq server running?"
48    exit 1
49fi
50
51if [ "$( echo $VERSION | sed 's/\.//g')" -lt 160 ]
52then
53    echo "rabbitmq version 1.6 is required.  Version $VERSION is currently installed."
54    exit 1
55fi
56
57$RMQCTL delete_vhost /apiary
58$RMQCTL delete_user apiary
59$RMQCTL add_user apiary beehonest
60$RMQCTL add_vhost /apiary
61$RMQCTL set_permissions -p /apiary apiary '.*' '.*' '.*'
62
63
64