Fix crontab permissions
This commit is contained in:
1 parent
898e42e0b7
commit
cdd629cea4
2 files changed
+5
-6
No files matched your search
+5
-5
@@ -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
|
||||
Reference in new issue
Block a user