Fix crontab permissions
This commit is contained in:
1 parent
cdd629cea4
commit
7933ee81eb
2 files changed
+12
-5
No files matched your search
+7
-5
@@ -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
|
||||||
RUN echo ' 5 * * * * python3 /usr/cta-archive/archive.py ' >> /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 logfile
|
# Create logfile
|
||||||
RUN touch /var/log/cron.log
|
RUN touch /var/log/cron.log
|
||||||
|
|
||||||
# Run the command on container startup
|
# Run the command on container startup
|
||||||
CMD cron && tail -f /var/log/cron.log
|
ENTRYPOINT [ "/usr/cta-archive/entrypoint.sh" ]
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
printenv >> /etc/environment
|
||||||
|
|
||||||
|
cron -f
|
||||||
Reference in new issue
Block a user