Pass environment variables to the cron job

This commit is contained in:
Anton Zadvorny 2020-01-22 14:25:15 +03:00
parent 2d95141cf1
commit 2878fee9ae
4 changed files with 9 additions and 4 deletions

View File

@ -1,10 +1,10 @@
FROM python:3.8
FROM debian:buster
ENV TZ=Europe/Moscow
ENV TERM=xterm-color
RUN apt-get update && \
apt-get install -y --no-install-recommends cron python3-pymysql python3-qrcode p7zip && \
apt-get install -y --no-install-recommends cron python3 python3-pymysql python3-qrcode p7zip && \
rm -rf /var/lib/apt/lists/*
RUN \
@ -15,5 +15,6 @@ COPY cron /etc/cron.d/gtfs2qr
RUN chmod 0755 /etc/cron.d/gtfs2qr && crontab /etc/cron.d/gtfs2qr
COPY gtfs2qr /opt/gtfs2qr
COPY start.sh /bin/start.sh
CMD ["cron", "-f"]
CMD ["start.sh"]

View File

@ -1 +1 @@
* * * * * root python3 /opt/gtfs2qr/gtfs2qr.py > /opt/gtfs2qr/logs.log 2>&1
* * * * * root . /etc/environment; python3 /opt/gtfs2qr/gtfs2qr.py > /opt/gtfs2qr/logs.log 2>&1

4
gtfs2qr/start.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
env | egrep '^DB|^FTP' > /etc/environment
cron -f