Add distribted cron script

This commit is contained in:
holzi1005 2024-11-15 19:30:43 +01:00
parent be0e93358c
commit a77e302725

View file

@ -33,9 +33,13 @@ RUN mkdir /etc/service/crond \
&& setcap cap_setgid=ep /usr/sbin/crond \ && setcap cap_setgid=ep /usr/sbin/crond \
&& setcap cap_setuid=ep /usr/sbin/crond && setcap cap_setuid=ep /usr/sbin/crond
RUN wget https://git.h2-invent.com/Public-System-Design/Public-Helperscripts/raw/branch/main/distributed_cron.sh -O /distributed_cron.sh \
&& chmod +x /distributed_cron.sh
RUN echo "# Docker Cron Jobs" > /etc/crontabs/nobody \ RUN echo "# Docker Cron Jobs" > /etc/crontabs/nobody \
&& echo "* * * * * curl http://localhost:8080/health/check > /dev/null > 2>&1" >> /etc/crontabs/nobody \ && echo "* * * * * curl http://localhost:8080/health/check > /dev/null > 2>&1" >> /etc/crontabs/nobody \
&& echo "0 1 * * * curl https://open-datenschutzcenter.de/health/check > /dev/null > 2>&1" >> /etc/crontabs/nobody \ && echo "0 1 * * * curl https://open-datenschutzcenter.de/health/check > /dev/null > 2>&1" >> /etc/crontabs/nobody \
&& echo "0 9 * * 1-5 /bin/sh /distributed_cron.sh '${WEBDIR}/data/cron_log' 'php ${WEBDIR}/bin/console app:cron' >/dev/null 2>&1" >> /etc/crontabs/nobody \
&& chown nobody:nobody /etc/crontabs/nobody \ && chown nobody:nobody /etc/crontabs/nobody \
&& chmod +x /etc/crontabs/nobody && chmod +x /etc/crontabs/nobody