File: destroy.sh

package info (click to toggle)
python-es-client 8.17.4-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 520 kB
  • sloc: python: 2,452; sh: 239; makefile: 17
file content (30 lines) | stat: -rwxr-xr-x 824 bytes parent folder | download
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
#!/bin/bash

# Source the common.bash file from the same path as the script
source $(dirname "$0")/common.bash

echo

# Stop and remove the docker container
RUNNING=$(docker ps -f name=${NAME} | grep -v NAMES | awk '{print $NF}')
EXISTS=$(docker ps -af name=${NAME} | grep -v NAMES | awk '{print $NF}')
if [ "${RUNNING}" == "${NAME}" ]; then
  echo "Stopping container ${NAME}..."
  echo "$(docker stop ${NAME}) stopped."
fi
if [ "${EXISTS}" == "${NAME}" ]; then
  echo "Removing container ${NAME}..."
  echo "$(docker rm -f ${NAME}) deleted."
fi

# Delete Docker network
docker network rm -f ${NAME}-net > /dev/null 2>&1

# Delete .env file and curl config file
echo "Deleting remaining files and directories"
rm -rf ${REPOLOCAL}
rm -f ${ENVCFG}
rm -f ${CURLCFG}
rm -f ${PROJECT_ROOT}/http_ca.crt

echo "Cleanup complete."