From 36ea19e5273876d20a9cb5fad2841dbef9bf2e2a Mon Sep 17 00:00:00 2001 From: David Rotermund Date: Tue, 16 Jul 2024 17:15:40 +0200 Subject: [PATCH] Create check_docker.sh --- check_docker.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 check_docker.sh diff --git a/check_docker.sh b/check_docker.sh new file mode 100644 index 0000000..88e76a7 --- /dev/null +++ b/check_docker.sh @@ -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 +