Create check_docker.sh

This commit is contained in:
David Rotermund 2024-07-16 17:15:40 +02:00 committed by GitHub
parent 1363bb8047
commit 36ea19e527
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

16
check_docker.sh Normal file
View file

@ -0,0 +1,16 @@
#!/bin/bash
# List of expected container names
expected_containers=("overleafregister" "overleafnginx" "overleafserver" "overleafredis" "overleafmongo")
# 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