You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
769 B
Bash
25 lines
769 B
Bash
8 months ago
|
#!/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:<NTFY_NOTIFICATION_URL> \
|
||
|
-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
|