From cdd629cea4d265718cc3b8e520c054f525c1ff18 Mon Sep 17 00:00:00 2001 From: iosullivan Date: Sat, 18 Jul 2026 15:39:51 +0800 Subject: [PATCH] Fix crontab permissions --- Dockerfile | 10 +++++----- cronjob | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) delete mode 100644 cronjob diff --git a/Dockerfile b/Dockerfile index 245e521..656838e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM python:3.9-slim # Install cron -RUN apt-get update && apt-get install -y cron +RUN apt-get update && apt-get install -y cron nano # Set the working directory WORKDIR /usr/cta-archive/ @@ -14,7 +14,7 @@ COPY . . RUN pip install --no-cache-dir -r requirements.txt # Copy the cron job file into the cron.d directory -COPY cronjob /etc/cron.d/cronjob +RUN echo ' 5 * * * * python3 /usr/cta-archive/archive.py ' >> /etc/cron.d/cronjob # Give execution rights on the cron job RUN chmod 0644 /etc/cron.d/cronjob @@ -22,8 +22,8 @@ RUN chmod 0644 /etc/cron.d/cronjob # Apply the cron job RUN crontab /etc/cron.d/cronjob -# Create the log file to be able to run tail -RUN touch /var/log/cron_python.log +# Create logfile +RUN touch /var/log/cron.log # Run the command on container startup -CMD ["cron","-f" ] \ No newline at end of file +CMD cron && tail -f /var/log/cron.log \ No newline at end of file diff --git a/cronjob b/cronjob deleted file mode 100644 index af62af9..0000000 --- a/cronjob +++ /dev/null @@ -1 +0,0 @@ -5 * * * * root python3 /usr/cta-archive/archive.py