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

This commit is contained in:
2025-08-16 10:52:25 +10:00
parent 15f2a80d10
commit 2832e32d46

16
record-docker-updates Executable file
View File

@@ -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