-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathstatus.sh
executable file
·35 lines (29 loc) · 961 Bytes
/
status.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
#!/bin/bash
# Define container names
CONTAINERS=("companion-computer" "ground-control-station" "flight-controller" "simulator")
ENVIRONMENT_STATUS="Stopped"
# Check if Docker is running
if ! command -v docker &> /dev/null
then
echo "Docker is not installed or not in PATH."
exit 1
fi
# Function to check the status of each container
check_container_status() {
local container=$1
local status=$(docker ps -a --filter "name=$container" --format "{{.Status}}" | head -n 1)
if [[ $status == *"Up"* ]]; then
ENVIRONMENT_STATUS="Running"
echo "$container is running. Status: $status"
elif [[ $status == *"Exited"* ]]; then
echo "$container is stopped. Status: $status"
else
echo "$container not found."
fi
}
echo "Checking the status of the Damn Vulnerable Drone environment..."
# Check the status of each container
for container in "${CONTAINERS[@]}"
do
check_container_status $container
done