From d01fbeb68a157d6338b2fa71d00d82a0cd380184 Mon Sep 17 00:00:00 2001 From: Djeex Date: Sat, 31 May 2025 16:20:51 +0000 Subject: [PATCH] Replaced busybox cron with dcron (alpine) --- Dockerfile | 2 +- entrypoint.sh | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0e687fa..912fa7b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM alpine:latest -RUN apk add --no-cache curl bash busybox-cron tzdata +RUN apk add --no-cache curl bash dcron tzdata COPY update-blocklist.sh /usr/local/bin/update-blocklist.sh COPY entrypoint.sh /entrypoint.sh diff --git a/entrypoint.sh b/entrypoint.sh index a9bdaf0..1918d3a 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,11 +3,15 @@ set -e if [ -n "$TZ" ]; then - cp /usr/share/zoneinfo/$TZ /etc/localtime - echo "$TZ" > /etc/timezone + if [ -f "/usr/share/zoneinfo/$TZ" ]; then + cp "/usr/share/zoneinfo/$TZ" /etc/localtime + echo "$TZ" > /etc/timezone + else + echo "Warning: Timezone file /usr/share/zoneinfo/$TZ not found, skipping timezone setup." + fi fi -CRON_EXPR="${BLOCKLIST_CRON:-"0 6 * * *"}" # default: every hour +CRON_EXPR="${BLOCKLIST_CRON:-"0 6 * * *"}" # default: every day at 6:00 am SCRIPT_PATH="/usr/local/bin/update-blocklist.sh" echo "Installing cron job with expression: $CRON_EXPR" @@ -15,4 +19,4 @@ echo "Installing cron job with expression: $CRON_EXPR" echo "$CRON_EXPR root $SCRIPT_PATH" > /etc/crontabs/root echo "Starting cron..." -crond -f -L /dev/stdout +exec crond -f -L /dev/stdout