-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.sh
executable file
·47 lines (40 loc) · 1.41 KB
/
setup.sh
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
# Container names
containers=("olaos_main" "olaos_replica")
# Iterate over the containers
for container_name_or_id in "${containers[@]}"; do
# Check if the container exists
if docker inspect "$container_name_or_id" >/dev/null 2>&1; then
# If the container exists, stop it
echo "Container $container_name_or_id exists, stopping the container..."
if docker stop "$container_name_or_id" >/dev/null 2>&1; then
echo "Container $container_name_or_id stopped successfully."
sleep 1
# Remove the container
echo "Removing container $container_name_or_id..."
if docker rm "$container_name_or_id" >/dev/null 2>&1; then
echo "Container $container_name_or_id removed successfully."
else
echo "Failed to remove container $container_name_or_id."
fi
else
echo "Failed to stop container $container_name_or_id."
fi
else
# If the container does not exist, print a message
echo "Container $container_name_or_id does not exist, no action needed."
fi
done
# remove rocks db
rm -rf ./db &&
# remove object store files
rm -rf ./artifacts &&
# remove pg db and log
cd dal &&
rm -rf ./scripts/archivelog &&
rm -rf ./scripts/data-backup &&
rm -rf ./scripts/olaos_pgdata &&
# start new pg
./scripts/init_main_db.sh &&
./scripts/init_replica_db.sh &&
cd ..