From 32dd2e3c33e0cb569b8e50a4cc203a73146e3f29 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 2 Apr 2019 14:21:34 +0200 Subject: Docker better use of crontab (#2326) Misc. from https://github.com/FreshRSS/FreshRSS/pull/2325 https://github.com/FreshRSS/FreshRSS/issues/2319 --- Docker/Dockerfile | 4 ++-- Docker/Dockerfile-Alpine | 8 ++++---- Docker/README.md | 13 ++++++++++++- Docker/entrypoint.sh | 2 +- 4 files changed, 19 insertions(+), 8 deletions(-) (limited to 'Docker') diff --git a/Docker/Dockerfile b/Docker/Dockerfile index efd77c6a1..798561c93 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -25,8 +25,8 @@ RUN a2dismod -f alias autoindex negotiation status && \ RUN sed -r -i "/^\s*(CustomLog|ErrorLog|Listen) /s/^/#/" /etc/apache2/apache2.conf && \ sed -r -i "/^\s*Listen /s/^/#/" /etc/apache2/ports.conf && \ - echo "17,37 * * * * su www-data -s /bin/sh -c 'php /var/www/FreshRSS/app/actualize_script.php' 2>> /proc/1/fd/2 > /tmp/FreshRSS.log" >> \ - /var/spool/cron/crontabs/root + echo "17,47 * * * * su www-data -s /bin/sh -c 'php /var/www/FreshRSS/app/actualize_script.php' 2>> /proc/1/fd/2 > /tmp/FreshRSS.log" | \ + crontab - ENV COPY_SYSLOG_TO_STDERR On ENV CRON_MIN '' diff --git a/Docker/Dockerfile-Alpine b/Docker/Dockerfile-Alpine index cd0f521a0..fcaec37da 100644 --- a/Docker/Dockerfile-Alpine +++ b/Docker/Dockerfile-Alpine @@ -16,14 +16,14 @@ COPY ./Docker/*.Apache.conf /etc/apache2/conf.d/ RUN rm -f /etc/apache2/conf.d/languages.conf /etc/apache2/conf.d/info.conf \ /etc/apache2/conf.d/status.conf /etc/apache2/conf.d/userdir.conf && \ - sed -r -i "/^\s*LoadModule .*mod_(alias|autoindex|negotiation|status).so$/s/^/#/" \ + sed -r -i "/^\s*LoadModule .*mod_(alias|autoindex|negotiation|status).so$/s/^/#/" \ /etc/apache2/httpd.conf && \ - sed -r -i "/^\s*#\s*LoadModule .*mod_(deflate|expires|headers|mime|setenvif).so$/s/^\s*#//" \ + sed -r -i "/^\s*#\s*LoadModule .*mod_(deflate|expires|headers|mime|setenvif).so$/s/^\s*#//" \ /etc/apache2/httpd.conf && \ sed -r -i "/^\s*(CustomLog|ErrorLog|Listen) /s/^/#/" \ /etc/apache2/httpd.conf && \ - echo "17,37 * * * * su apache -s /bin/sh -c 'php /var/www/FreshRSS/app/actualize_script.php' 2>> /proc/1/fd/2 > /tmp/FreshRSS.log" >> \ - /var/spool/cron/crontabs/root + echo "27,57 * * * * su apache -s /bin/sh -c 'php /var/www/FreshRSS/app/actualize_script.php' 2>> /proc/1/fd/2 > /tmp/FreshRSS.log" | \ + crontab - ENV COPY_SYSLOG_TO_STDERR On ENV CRON_MIN '' diff --git a/Docker/README.md b/Docker/README.md index 3cfb05c69..9bf20c8c2 100644 --- a/Docker/README.md +++ b/Docker/README.md @@ -211,12 +211,23 @@ For advanced users. Offers good logging and monitoring with auto-restart on fail Watch out to use the same run parameters than in your main FreshRSS instance, for database, networking, and file system. See cron option 1 for customising the cron schedule. +#### For the Ubuntu image (default) ```sh sudo docker run -d --restart unless-stopped --log-opt max-size=10m \ -v freshrss-data:/var/www/FreshRSS/data \ - -e 'CRON_MIN=17,37' \ + -e 'CRON_MIN=17,47' \ --net freshrss-network \ --name freshrss_cron freshrss/freshrss \ + cron +``` + +#### For the Alpine image +```sh +sudo docker run -d --restart unless-stopped --log-opt max-size=10m \ + -v freshrss-data:/var/www/FreshRSS/data \ + -e 'CRON_MIN=27,57' \ + --net freshrss-network \ + --name freshrss_cron freshrss/freshrss:alpine \ crond -f -d 6 ``` diff --git a/Docker/entrypoint.sh b/Docker/entrypoint.sh index 528388073..9db5c8185 100755 --- a/Docker/entrypoint.sh +++ b/Docker/entrypoint.sh @@ -8,7 +8,7 @@ chmod -R g+r . && chmod -R g+w ./data/ find /etc/php*/ -name php.ini -exec sed -r -i "\#^;?date.timezone#s#^.*#date.timezone = $TZ#" {} \; if [ -n "$CRON_MIN" ]; then - sed -r -i "\#FreshRSS#s#^[^ ]+ #$CRON_MIN #" /var/spool/cron/crontabs/root + crontab -l | sed -r "\#FreshRSS#s#^[^ ]+ #$CRON_MIN #" | crontab - fi exec "$@" -- cgit v1.2.3