mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-09-02 08:29:43 +02:00
Implemented docker health check
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
[Unit]
|
||||
Description=Check docker status
|
||||
OnFailure=systemd-email@%n.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/bash /home/administrator/scripts/docker-health-check/docker-health-check.sh
|
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
docker_ps_grep_unhealthy="$(docker ps | grep unhealthy)"
|
||||
if [ -z "$docker_ps_grep_unhealthy" ]
|
||||
then
|
||||
echo "All docker containers are healthy."
|
||||
exit
|
||||
else
|
||||
echo "Some docker containers are unhealthy: $docker_ps_grep_unhealthy"
|
||||
exit 1
|
||||
fi
|
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=starts docker-health-check.service
|
||||
|
||||
[Timer]
|
||||
OnCalendar=10:00
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
Reference in New Issue
Block a user