Fixes to wrapper entrypoint

This commit is contained in:
Frederick Ding 2015-07-31 01:01:41 -04:00
parent 66b6afd893
commit 785f4c8d75
2 changed files with 14 additions and 8 deletions

View File

@ -4,6 +4,9 @@ MAINTAINER Ding Corporation
VOLUME /var/mail /config /output
ADD save-attachments.crontab /etc/cron.d/save-attachments
ADD save-attachments.sh /opt/save-attachments.sh
# install packages
RUN apt-get update \
&& apt-get install -y fetchmail maildrop mpack \
@ -12,13 +15,10 @@ RUN apt-get update \
RUN maildirmake /var/mail/working \
&& mkdir /var/mail/working/landing \
&& mkdir /var/mail/working/extracted \
&& echo "to /var/mail/working" > /root/.mailfilter
RUN touch /var/mail/save-attachments.log
ADD save-attachments.crontab /etc/cron.d/save-attachments
ADD save-attachments.sh /opt/save-attachments.sh
RUN chmod 0644 /etc/cron.d/save-attachments
&& echo "to /var/mail/working" > /root/.mailfilter \
&& touch /var/mail/save-attachments.log \
&& chmod 0644 /etc/cron.d/save-attachments
ADD docker-entrypoint.sh /opt/docker-entrypoint.sh
ENTRYPOINT ["/opt/docker-entrypoint.sh"]
CMD cron && tail -f /var/mail/save-attachments.log
CMD ["cron"]

View File

@ -9,6 +9,7 @@ else
mkdir /var/mail/working/landing
mkdir /var/mail/working/extracted
echo "to /var/mail/working" > /root/.mailfilter
touch /var/mail/save-attachments.log
fi
# check for user config fetchmailrc
@ -35,6 +36,7 @@ then
update-ca-certificates
fi
echo "$1"
if [ "$1" = 'cron' ] || [ "$1" = '/opt/save-attachments.sh' ]; then
if [ ! -f /root/.fetchmailrc ]; then
echo "Cannot start container without .fetchmailrc"
@ -42,4 +44,8 @@ if [ "$1" = 'cron' ] || [ "$1" = '/opt/save-attachments.sh' ]; then
fi
fi
exec "$@"
if [ "$1" = 'cron' ]; then
exec /usr/sbin/cron && tail -f /var/mail/save-attachments.log
else
exec "$@"
fi