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
|
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/
|
||||||
@@ -14,7 +14,7 @@ COPY . .
|
|||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# 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 * * * * python3 /usr/cta-archive/archive.py ' >> /etc/cron.d/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 /etc/cron.d/cronjob
|
||||||
@@ -22,8 +22,8 @@ RUN chmod 0644 /etc/cron.d/cronjob
|
|||||||
# Apply the cron job
|
# Apply the cron job
|
||||||
RUN crontab /etc/cron.d/cronjob
|
RUN crontab /etc/cron.d/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" ]
|
CMD cron && tail -f /var/log/cron.log
|
||||||
Reference in new issue
Block a user