Create check_docker.sh
This commit is contained in:
parent
1363bb8047
commit
36ea19e527
1 changed files with 16 additions and 0 deletions
16
check_docker.sh
Normal file
16
check_docker.sh
Normal 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
|
||||||
|
|
Loading…
Reference in a new issue