Преглед на файлове

Docker better use of crontab (#2326)

Misc. from https://github.com/FreshRSS/FreshRSS/pull/2325
https://github.com/FreshRSS/FreshRSS/issues/2319
Alexandre Alapetite преди 7 години
родител
ревизия
32dd2e3c33
променени са 4 файла, в които са добавени 19 реда и са изтрити 8 реда
  1. 2 2
      Docker/Dockerfile
  2. 4 4
      Docker/Dockerfile-Alpine
  3. 12 1
      Docker/README.md
  4. 1 1
      Docker/entrypoint.sh

+ 2 - 2
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 ''

+ 4 - 4
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 ''

+ 12 - 1
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
 ```
 

+ 1 - 1
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 "$@"