Files
bin/record-docker-updates

17 lines
696 B
Bash
Executable File

#!/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