Fix crontab permissions

This commit is contained in:
iosullivan committed 2026-07-18 15:39:51 +08:00
1 parent 898e42e0b7
commit cdd629cea4
2 files changed
+5 -6

No files matched your search

+5 -5
View File
@@ -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" ]
CMD cron && tail -f /var/log/cron.log
-1
View File
@@ -1 +0,0 @@
5 * * * * root python3 /usr/cta-archive/archive.py