From 9aded6e181f91970170490b1602cacf0c850edae Mon Sep 17 00:00:00 2001 From: Holden Date: Wed, 10 Jun 2026 16:44:41 -0400 Subject: [PATCH] fix cron --- Dockerfile | 5 +++-- entrypoint.sh | 17 ++++------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 358a8e2..5d6d29b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ git \ curl \ g++ \ - cron \ && rm -rf /var/lib/apt/lists/* \ && ln -sf /usr/bin/python3.12 /usr/bin/python \ && ln -sf /usr/bin/python3.12 /usr/bin/python3 @@ -27,9 +26,10 @@ WORKDIR /app RUN git clone --depth 1 https://github.com/sudolulo/if_curator_headless.git . \ && uv sync --extra gpu \ + && uv add croniter \ && uv cache clean -COPY entrypoint.sh /app/entrypoint.sh +COPY entrypoint.sh scheduler.py /app/ RUN chmod +x /app/entrypoint.sh RUN groupadd -g 568 apps \ @@ -43,3 +43,4 @@ ENV FORCE_CPU=false \ INSIGHTFACE_HOME=/models/insightface ENTRYPOINT ["/app/entrypoint.sh"] + diff --git a/entrypoint.sh b/entrypoint.sh index af13984..2e2d25d 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,18 +9,9 @@ if [ -z "$SCHEDULE" ]; then exit 0 fi -# Validate cron expression -if ! echo "$SCHEDULE" | cron-validate 2>/dev/null; then - echo "⚠️ Could not validate cron expression, attempting anyway: $SCHEDULE" -fi +echo "▶ CRON_SCHEDULE set to: $SCHEDULE" +echo "▶ Running if-curator on schedule..." -# Write cron job (run as appuser) -CRON_CMD="cd /app && /root/.local/bin/uv run if-curator >> /proc/1/fd/1 2>&1" -echo "$SCHEDULE appuser $CRON_CMD" > /etc/crontab +# Hand off to the Python scheduler +exec uv run python3 /app/scheduler.py -echo "▶ Scheduled with cron: $SCHEDULE" -echo "▶ Next run: $(crontab -l 2>/dev/null || echo 'see /etc/crontab')" - -# Start cron daemon in foreground -echo "▶ Cron daemon started. Waiting for scheduled runs..." -cron -f