HajTex_living_with_keycloak/docker/check_docker.sh

15 lines
531 B
Bash

#!/bin/bash
# List of expected container names
expected_containers=("overleafregister" "nginx" "checkuser" "overleafserver" "keycloakserver" "keycloakpostgres" "overleafmongo" "overleafredis" "hajtexsshd")
# Email settings
recipient="overleaf@uni-bremen.de"
subject="Docker Container Alert"
# Check containers
for container in "${expected_containers[@]}"; do
if ! docker ps --format '{{.Names}}' | grep -q "^$container$"; then
echo "Container $container is not running" | mail -s "$subject" "$recipient"
fi
done