From 2832e32d461caf9b40ddf6e598a6987844128d14 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Sat, 16 Aug 2025 10:52:25 +1000 Subject: [PATCH] creates the condensed log of just the scan state and updates from watchtower that kuma-watchtower-ran uses to see if last night it ran --- record-docker-updates | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 record-docker-updates diff --git a/record-docker-updates b/record-docker-updates new file mode 100755 index 0000000..fad54a8 --- /dev/null +++ b/record-docker-updates @@ -0,0 +1,16 @@ +#!/bin/bash + +# This script simply greps for the containers updated and overall state from watchtower +# but just for today and stores this into $DOCKER_DIR/log/... +# (use today, as watchtower runs at 3am, this cron after 6am) + +export DOCKER_DIR=/srv/docker +export LOG=$DOCKER_DIR/log/update-docker.log +export CONF=$DOCKER_DIR/config/docker-compose.yml + +TODAY=$(/bin/date '+%Y-%m-%d') + +/bin/docker compose -f $CONF logs watchtower 2>&1 | /bin/grep "$TODAY.*Session done" | /bin/awk '{for(i=3;i<=NF;++i)printf "%s ", $i; print ""}' >> $LOG +/bin/docker compose -f $CONF logs watchtower 2>&1 | /bin/grep "$TODAY.*Found new" | /bin/awk '{for(i=3;i<=NF;++i)printf "%s ", $i; print ""}' >> $LOG + +exit 0