From 7e26604e8f8c81838cc448eb91c452ec26f1b7d3 Mon Sep 17 00:00:00 2001 From: "David M. Klein" <4+leander19961@noreply.localhost> Date: Thu, 27 Aug 2026 13:46:46 +0200 Subject: [PATCH] =?UTF-8?q?docker/syncer/entrypoint.sh=20gel=C3=B6scht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/syncer/entrypoint.sh | 43 ------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 docker/syncer/entrypoint.sh diff --git a/docker/syncer/entrypoint.sh b/docker/syncer/entrypoint.sh deleted file mode 100644 index 40d9ff5..0000000 --- a/docker/syncer/entrypoint.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash -# Container entrypoint: run sync.sh once, or in a loop every -# SYNC_INTERVAL_SECONDS. There's no systemd/cron inside the container, so a -# simple sleep-loop is the pragmatic choice. -set -euo pipefail - -: "${SYNC_INTERVAL_SECONDS:=3600}" -: "${RUN_ONCE:=false}" - -log() { echo "[entrypoint] $(date '+%Y-%m-%d %H:%M:%S') $*"; } - -run_once() { - /usr/local/bin/sync.sh -} - -if [[ "$RUN_ONCE" == "true" ]]; then - log "RUN_ONCE=true - running sync.sh once and exiting" - run_once - exit $? -fi - -log "Starting sync loop (interval: ${SYNC_INTERVAL_SECONDS}s)" - -# Graceful shutdown on docker stop / compose down -term_handler() { - log "Received SIGTERM, shutting down" - exit 0 -} -trap term_handler SIGTERM SIGINT - -while true; do - # NOTE: don't inline `run_once` into `if ! run_once; then ...` - inside - # that then-branch, $? would reflect the (always-0) negated test itself, - # not run_once's real exit code. Capture it explicitly instead. - rc=0 - run_once || rc=$? - if [[ $rc -ne 0 ]]; then - log "sync.sh failed (exit ${rc}) - will retry after the next interval" - fi - log "Sleeping ${SYNC_INTERVAL_SECONDS}s until next sync..." - sleep "${SYNC_INTERVAL_SECONDS}" & - wait $! -done \ No newline at end of file