Create check_docker.sh
This commit is contained in:
parent
3e743c91d1
commit
85b8915757
1 changed files with 15 additions and 0 deletions
15
check_docker.sh
Normal file
15
check_docker.sh
Normal file
|
@ -0,0 +1,15 @@
|
|||
#!/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
|
Loading…
Reference in a new issue