vaultwardenub/check_docker.sh

16 lines
426 B
Bash
Raw Permalink Normal View History

2024-07-16 16:47:34 +02:00
#!/bin/bash
# List of expected container names
expected_containers=("vaultwarden" "nginx" "mariadb")
# Email settings
recipient="paserver@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