forked from imesh/wso2-apim-conf
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclean.sh
More file actions
executable file
·47 lines (36 loc) · 1.15 KB
/
clean.sh
File metadata and controls
executable file
·47 lines (36 loc) · 1.15 KB
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
#!/bin/bash
function wait_for_process_to_exit() {
port=$1
while echo exit | (nc localhost ${port} > /dev/null); do sleep 2; done
}
printf "Do you really want to clear the deployment (y/n)? "
read -r terminate
if [[ $terminate == "n" || $terminate == "N" ]]; then
exit 1;
fi
echo "Removing MySQL database containers..."
docker rm -f "wso2-apim-db"
docker rm -f "wso2-apim-analytics-db"
echo "Stopping API-M analytics node..."
sh "wso2am-analytics-2.1.0/bin/wso2server.sh" -Dsetup stop
echo "Stopping API-M node 1..."
sh "wso2am-2.1.0-1/bin/wso2server.sh" -Dsetup stop
if [ -d "wso2am-2.1.0-2/" ]; then
echo "Stopping API-M node 2..."
sh "wso2am-2.1.0-2/bin/wso2server.sh" -Dsetup stop
fi
echo "Waiting for API-M analytics to stop..."
wait_for_process_to_exit 9444
echo "Waiting for API-M node 1 to stop..."
wait_for_process_to_exit 9443
if [ -d "wso2am-2.1.0-2/" ]; then
echo "Waiting for API-M node 2 to stop..."
wait_for_process_to_exit 9445
fi
echo "Removing WSO2 API-M distributions..."
rm -rf "wso2am-2.1.0-1"
if [ -d "wso2am-2.1.0-2/" ]; then
rm -rf "wso2am-2.1.0-2"
fi
rm -rf "wso2am-analytics-2.1.0"
echo "Clean process completed!"