Add distribted cron script
This commit is contained in:
parent
a77e302725
commit
f8e3a7d937
1 changed files with 71 additions and 67 deletions
|
@ -33,6 +33,9 @@ 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 mkdir /etc/service/symfony_messenger \
|
RUN mkdir /etc/service/symfony_messenger \
|
||||||
&& echo "#!/bin/sh -e" > /etc/service/symfony_messenger/run \
|
&& echo "#!/bin/sh -e" > /etc/service/symfony_messenger/run \
|
||||||
&& echo "exec 2>&1 php -d memory_limit=-1 ${WEBDIR}/bin/console messenger:consume async --memory-limit=512m --env=prod" >> /etc/service/symfony_messenger/run \
|
&& echo "exec 2>&1 php -d memory_limit=-1 ${WEBDIR}/bin/console messenger:consume async --memory-limit=512m --env=prod" >> /etc/service/symfony_messenger/run \
|
||||||
|
@ -41,6 +44,7 @@ RUN mkdir /etc/service/symfony_messenger \
|
||||||
|
|
||||||
RUN echo "# Docker Cron Jobs" > /etc/crontabs/nobody \
|
RUN echo "# Docker Cron Jobs" > /etc/crontabs/nobody \
|
||||||
&& echo "* * * * * curl http://localhost:8080/health/check" >> /etc/crontabs/nobody \
|
&& echo "* * * * * curl http://localhost:8080/health/check" >> /etc/crontabs/nobody \
|
||||||
|
&& echo "* * * * * /bin/sh /distributed_cron.sh '${WEBDIR}/data/cron_log' 'php ${WEBDIR}/bin/console cron:run' >/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
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue