Compare commits

...
2 Commits
Author SHA1 Message Date
iosullivan 7933ee81eb Fix crontab permissions 2026-07-18 16:31:41 +08:00
iosullivan cdd629cea4 Fix crontab permissions 2026-07-18 15:39:51 +08:00
3 changed files with 15 additions and 9 deletions

No files matched your search

+10 -8
View File
@@ -2,7 +2,7 @@
FROM python:3.9-slim FROM python:3.9-slim
# Install cron # 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 # Set the working directory
WORKDIR /usr/cta-archive/ WORKDIR /usr/cta-archive/
@@ -13,17 +13,19 @@ COPY . .
# Install any needed packages # Install any needed packages
RUN pip install --no-cache-dir -r requirements.txt 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 # Copy the cron job file into the cron.d directory
COPY cronjob /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 # 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 # Add cron job
RUN crontab /etc/cron.d/cronjob RUN crontab /usr/cta-archive/cronjob
# Create the log file to be able to run tail # Create logfile
RUN touch /var/log/cron_python.log RUN touch /var/log/cron.log
# Run the command on container startup # Run the command on container startup
CMD ["cron","-f" ] ENTRYPOINT [ "/usr/cta-archive/entrypoint.sh" ]
-1
View File
@@ -1 +0,0 @@
5 * * * * root python3 /usr/cta-archive/archive.py
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
printenv >> /etc/environment
cron -f