From be52bd17ea01d8c302e39ba444194de282dc4728 Mon Sep 17 00:00:00 2001 From: Christian Segundo Date: Sat, 10 Jun 2023 00:11:39 +0200 Subject: First commit --- scripts/entrypoint.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 scripts/entrypoint.sh (limited to 'scripts/entrypoint.sh') diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh new file mode 100644 index 0000000..4d89be5 --- /dev/null +++ b/scripts/entrypoint.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -euo pipefail + +cat <> /etc/cron.d/crontab +PYTHON_PATH=/usr/local/bin/python3 +SCRIPT_PREFIX=/scripts +TRANSMISSION_HOST=${TRANSMISSION_HOST:-localhost} +TRANSMISSION_PORT=${TRANSMISSION_PORT:-9091} +EOF + +i=0 +while true; do + key="DELETE_TAG_${i}_NAME" + val="DELETE_TAG_${i}_AGE" + if [ -z "${!key:-}" ]; then + break + fi + cat <> /etc/cron.d/crontab +DELETE_TAG_${i}=${!key} +DELETE_AGE_${i}=${!val} +EOF + i=$((i+1)) +done + +echo "${CRON_EXPRESSION:-* * * * *} /bin/bash /scripts/cron.sh >/proc/1/fd/1 2>/proc/1/fd/2" >> /etc/cron.d/crontab +cat /etc/cron.d/crontab +crontab /etc/cron.d/crontab +cron -f -l "${CRON_LOG_LEVEL:-0}" -- cgit v1.2.3