#!/bin/bash # Add the below two lines (w/o comment) to crontab for docker user: # TZ=UTC # 0 12 22-28 * * /path/to/watchtowerOneTimeRun.sh # Exit unless Saturday if [[ $(date +%u) -ne 6 ]] ; then exit fi # Variables readonly HOST_HOSTNAME="${HOSTNAME}" # Docker run command docker run --rm \ -v /var/run/docker.sock:/var/run/docker.sock \ -e WATCHTOWER_NOTIFICATIONS=shoutrrr \ -e WATCHTOWER_NOTIFICATION_URL=ntfy://docker: \ -e WATCHTOWER_NOTIFICATIONS_HOSTNAME="${HOST_HOSTNAME}" \ -e WATCHTOWER_NOTIFICATION_TEMPLATE="{{range .}}{{.Time.Format \"2006-02-01 15:04:05\"}} ({{.Level}}): {{.Message}}{{println}}{{end}}" \ containrrr/watchtower:latest \ --no-startup-message \ --run-once \ --monitor-only