-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathstop
executable file
·73 lines (67 loc) · 2.42 KB
/
stop
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
. ./.env
if [ -n "${HA_NFS_DATA_DIRECTORY}" ]; then
. ${HA_NFS_DATA_DIRECTORY}/config/.env
fi
if [ -f /etc/redhat-release ] && [ `grep -c "Red Hat" /etc/redhat-release` -eq 1 ]; then
if [ `grep -c "7.9" /etc/redhat-release` -ge 1 ]; then
docker compose version &> /dev/null
if [ $? -eq 127 ]; then
echo "Could not find docker compose"
exit 1;
else
if [ -z "${HA_IP_LIST}" ]; then
alias compose_command="docker compose -f docker-compose.yml"
else
alias compose_command="docker compose -f docker-compose-ha.yml"
fi
fi
else
podman-compose version &> /dev/null
if [ $? -eq 127 ]; then
echo "Could not find podman-compose"
exit 1;
else
if [ -z "${HA_IP_LIST}" ]; then
alias compose_command="podman-compose -f podman-compose.yml"
else
alias compose_command="podman-compose -f podman-compose-ha.yml"
fi
fi
fi
else
docker compose version &> /dev/null
if [ $? -eq 127 ]; then
podman-compose version &> /dev/null
if [ $? -eq 127 ]; then
echo "Could not find docker compose or podman-compose"
exit 1;
else
if [ -z "${HA_IP_LIST}" ]; then
alias compose_command="podman-compose -f podman-compose.yml"
else
alias compose_command="podman-compose -f podman-compose-ha.yml"
fi
fi
else
if [ -z "${HA_IP_LIST}" ]; then
alias compose_command="docker compose -f docker-compose.yml"
else
alias compose_command="docker compose -f docker-compose-ha.yml"
fi
fi
fi
if [ -n "${HA_IP_LIST}" ]; then
./replica_set --remove
RETURN=$?
if [ $RETURN -eq 0 ]; then
compose_command exec -- rabbitmq-stats rabbitmq-queues delete_member cloudexchange_9 rabbit@$HA_CURRENT_NODE
compose_command exec -- rabbitmq-stats rabbitmq-queues delete_member cloudexchange_6 rabbit@$HA_CURRENT_NODE
compose_command exec -- rabbitmq-stats rabbitmq-queues delete_member cloudexchange_3 rabbit@$HA_CURRENT_NODE
compose_command exec -- rabbitmq-stats rabbitmqctl stop_app
compose_command exec -- rabbitmq-stats rabbitmqctl reset
elif [ $RETURN -eq 1 ]; then
exit 0
fi
fi
compose_command down -v