aboutsummaryrefslogtreecommitdiffstats
path: root/ansible/roles/configure_rabbitmq/templates/rabbitmq.sh.j2
blob: a91565c012b6738d83cf3cb7dbee56c4a2f61af0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
trap "rabbitmqctl stop_app" EXIT

rabbitmqctl stop_app
service rabbitmq-server restart
rabbitmqctl start_app

tmp_file="/tmp/$(basename -- $0).configured"
if [ ! -f "$tmp_file" ]; then
    rabbitmqctl add_user yardstick yardstick
    rabbitmqctl set_permissions -p / yardstick '.*' '.*' '.*'
    touch "$tmp_file"
fi

while :
do
    sleep 5
    service rabbitmq-server status > /dev/null 2>&1 || exit 1
    rabbitmqctl report | grep "Status of node rabbit@`hostname`" > /dev/null 2>&1 || exit 1
done