Forward environment to cron via crontab file
This commit is contained in:
parent
58fe0314a9
commit
ef94550b64
4 changed files with 20 additions and 7 deletions
|
@ -6,9 +6,7 @@ RUN \
|
|||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
ADD files/main.py /main.py
|
||||
ADD files/entrypoint.sh /entrypoint.sh
|
||||
ADD files/crontab.tpl /crontab.tpl
|
||||
|
||||
ADD files/crontab /etc/cron.d/assembly-cron
|
||||
RUN chmod 0644 /etc/cron.d/assembly-cron
|
||||
RUN crontab /etc/cron.d/assembly-cron
|
||||
|
||||
CMD ["cron", "-f"]
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
|
14
files/entrypoint.sh
Executable file
14
files/entrypoint.sh
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Create crontab with current environment variables
|
||||
(
|
||||
printenv
|
||||
echo
|
||||
cat /crontab.tpl
|
||||
) > /etc/cron.d/assembly-cron
|
||||
|
||||
# Install crontab
|
||||
crontab /etc/cron.d/assembly-cron
|
||||
|
||||
# Run cron daemon
|
||||
exec cron -f
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
# vim: sw=2:ts=2:noet
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
#### Assemble the Undead #####
|
||||
|
@ -55,8 +56,8 @@ smtp_from = os.getenv('SMTP_FROM')
|
|||
smtp_user = os.getenv('SMTP_USER')
|
||||
smtp_password = os.getenv('SMTP_PASSWORD')
|
||||
mail_subject = os.getenv('MAIL_SUBJECT')
|
||||
mail_header = os.getenv('MAIL_HEADER')
|
||||
mail_footer = os.getenv('MAIL_FOOTER')
|
||||
mail_header = os.getenv('MAIL_HEADER').replace("\\n","\n")
|
||||
mail_footer = os.getenv('MAIL_FOOTER').replace("\\n","\n")
|
||||
|
||||
def main(args):
|
||||
|
||||
|
|
Loading…
Reference in a new issue