/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. if [ $EUID != 0 ]
  27. then
  28. echo "You must be root to set up rabbitmq."
  29. exit 1
  30. fi
  31. RMQCTL=rabbitmqctl
  32. if [ -z "`which $RMQCTL`" ]
  33. then
  34. echo "$RMQCTL not found in your path. Make sure that rabbitmq is installed and that your path is correct."
  35. exit 1
  36. fi
  37. VERSION=$($RMQCTL status | grep RabbitMQ | cut -d ',' -f 4 | sed 's/["}]//g')
  38. if [ -z "$VERSION" ]
  39. then
  40. echo "Error retrieving rabbitmq version. Is the rabbitmq server running?"
  41. exit 1
  42. fi
  43. if [ "$( echo $VERSION | sed 's/\.//g')" -lt 160 ]
  44. then
  45. echo "rabbitmq version 1.6 is required. Version $VERSION is currently installed."
  46. exit 1
  47. fi
  48. $RMQCTL delete_vhost /apiary
  49. $RMQCTL delete_user apiary
  50. $RMQCTL add_user apiary beehonest
  51. $RMQCTL add_vhost /apiary
  52. $RMQCTL set_permissions -p /apiary apiary '.*' '.*' '.*'