From 2b788358728a786a0739f412e51dfc15b4b8bad7 Mon Sep 17 00:00:00 2001 From: Martin Lablans Date: Thu, 20 Oct 2022 16:55:05 +0200 Subject: [PATCH] Add housekeeping task (docker image cleanup) --- lib/update-bridgehead.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/update-bridgehead.sh b/lib/update-bridgehead.sh index dc108f5..e64abd6 100755 --- a/lib/update-bridgehead.sh +++ b/lib/update-bridgehead.sh @@ -1,6 +1,17 @@ #!/bin/bash source lib/functions.sh +AUTO_HOUSEKEEPING=${AUTO_HOUSEKEEPING:-true} + +if [ "$AUTO_HOUSEKEEPING" == "true" ]; then + A="Performing automatic maintenance: Cleaning docker images." + hc_send log "$A" + log INFO "$A" + docker system prune -a -f +else + log WARN "Automatic housekeeping disabled (variable AUTO_HOUSEKEEPING != \"true\")" +fi + hc_send log "Checking for bridgehead updates ..." CONFFILE=/etc/bridgehead/$1.conf