From 7933ee81ebceaa630e2e3084737709bee680ecd5 Mon Sep 17 00:00:00 2001 From: iosullivan Date: Sat, 18 Jul 2026 16:31:41 +0800 Subject: [PATCH] Fix crontab permissions --- Dockerfile | 12 +++++++----- entrypoint.sh | 5 +++++ 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 656838e..445cfdb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,17 +13,19 @@ COPY . . # Install any needed packages RUN pip install --no-cache-dir -r requirements.txt +# Load environment variable into cron job, as these aren't automatically passed +RUN echo '' # Copy the cron job file into the cron.d directory -RUN echo ' 5 * * * * python3 /usr/cta-archive/archive.py ' >> /etc/cron.d/cronjob +RUN echo ' */5 * * * * /usr/local/bin/python3 /usr/cta-archive/archive.py ' >> /usr/cta-archive/cronjob # Give execution rights on the cron job -RUN chmod 0644 /etc/cron.d/cronjob +RUN chmod 0644 /usr/cta-archive/cronjob -# Apply the cron job -RUN crontab /etc/cron.d/cronjob +# Add cron job +RUN crontab /usr/cta-archive/cronjob # Create logfile RUN touch /var/log/cron.log # Run the command on container startup -CMD cron && tail -f /var/log/cron.log \ No newline at end of file +ENTRYPOINT [ "/usr/cta-archive/entrypoint.sh" ] \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..c196ced --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +printenv >> /etc/environment + +cron -f