Merge pull request #220 from nextcloud/add-cron

Add cron
This commit is contained in:
Tilo Spannagel 2018-02-03 11:14:32 +01:00 committed by GitHub
commit bc93ce14ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 61 additions and 87 deletions

View File

@ -59,9 +59,8 @@ The required steps for each optional/recommended package that is not already in
`apt install LibreOffice` </br> `apt install LibreOffice` </br>
#### CRON via supervisor #### CRON via supervisor
`apt install supervisor cron` </br> `apt install supervisor` </br>
`mkdir /var/log/supervisord /var/run/supervisord` </br> `mkdir /var/log/supervisord /var/run/supervisord` </br>
`echo "*/15 * * * * su - www-data -s /bin/bash -c \"php -f /var/www/html/cron.php\""| crontab -` </br>
The following Dockerfile commands are also necessary for a sucessfull cron installation: </br> The following Dockerfile commands are also necessary for a sucessfull cron installation: </br>
`COPY supervisord.conf /etc/supervisor/supervisord.conf` </br> `COPY supervisord.conf /etc/supervisor/supervisord.conf` </br>
`CMD ["/usr/bin/supervisord"]` </br> `CMD ["/usr/bin/supervisord"]` </br>

View File

@ -36,20 +36,7 @@ services:
restart: always restart: always
volumes: volumes:
- nextcloud:/var/www/html - nextcloud:/var/www/html
user: www-data entrypoint: /cron.sh
entrypoint: |
bash -c 'bash -s <<EOF
trap "break;exit" SIGHUP SIGINT SIGTERM
while [ ! -f /var/www/html/config/config.php ]; do
sleep 1
done
while true; do
php -f /var/www/html/cron.php
sleep 15m
done
EOF'
depends_on: depends_on:
- db - db
- redis - redis

View File

@ -44,20 +44,7 @@ services:
restart: always restart: always
volumes: volumes:
- nextcloud:/var/www/html - nextcloud:/var/www/html
user: www-data entrypoint: /cron.sh
entrypoint: |
bash -c 'bash -s <<EOF
trap "break;exit" SIGHUP SIGINT SIGTERM
while [ ! -f /var/www/html/config/config.php ]; do
sleep 1
done
while true; do
php -f /var/www/html/cron.php
sleep 15m
done
EOF'
depends_on: depends_on:
- db - db
- redis - redis

View File

@ -40,20 +40,7 @@ services:
restart: always restart: always
volumes: volumes:
- nextcloud:/var/www/html - nextcloud:/var/www/html
user: www-data entrypoint: /cron.sh
entrypoint: |
bash -c 'bash -s <<EOF
trap "break;exit" SIGHUP SIGINT SIGTERM
while [ ! -f /var/www/html/config/config.php ]; do
sleep 1
done
while true; do
php -f /var/www/html/cron.php
sleep 15m
done
EOF'
depends_on: depends_on:
- db - db
- redis - redis

View File

@ -49,20 +49,7 @@ services:
restart: always restart: always
volumes: volumes:
- nextcloud:/var/www/html - nextcloud:/var/www/html
user: www-data entrypoint: /cron.sh
entrypoint: |
bash -c 'bash -s <<EOF
trap "break;exit" SIGHUP SIGINT SIGTERM
while [ ! -f /var/www/html/config/config.php ]; do
sleep 1
done
while true; do
php -f /var/www/html/cron.php
sleep 15m
done
EOF'
depends_on: depends_on:
- db - db
- redis - redis

View File

@ -2,11 +2,8 @@ FROM nextcloud:apache
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
supervisor \ supervisor \
cron \ && rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/lib/apt/lists/* && mkdir /var/log/supervisord /var/run/supervisord
RUN mkdir /var/log/supervisord /var/run/supervisord && \
echo "*/15 * * * * su - www-data -s /bin/bash -c \"php -f /var/www/html/cron.php\""| crontab -
COPY supervisord.conf /etc/supervisor/supervisord.conf COPY supervisord.conf /etc/supervisor/supervisord.conf

View File

@ -19,4 +19,4 @@ stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0 stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0 stderr_logfile_maxbytes=0
command=cron -f command=/cron.sh

View File

@ -2,11 +2,8 @@ FROM nextcloud:fpm
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
supervisor \ supervisor \
cron \ && rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/lib/apt/lists/* && mkdir /var/log/supervisord /var/run/supervisord
RUN mkdir /var/log/supervisord /var/run/supervisord && \
echo "*/15 * * * * su - www-data -s /bin/bash -c \"php -f /var/www/html/cron.php\""| crontab -
COPY supervisord.conf /etc/supervisor/supervisord.conf COPY supervisord.conf /etc/supervisor/supervisord.conf

View File

@ -19,4 +19,4 @@ stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0 stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0 stderr_logfile_maxbytes=0
command=cron -f command=/cron.sh

View File

@ -3,7 +3,6 @@ FROM nextcloud:apache
RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list \ RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list \
&& apt-get update && apt-get install -y \ && apt-get update && apt-get install -y \
supervisor \ supervisor \
cron \
ffmpeg \ ffmpeg \
libmagickwand-dev \ libmagickwand-dev \
libgmp3-dev \ libgmp3-dev \
@ -18,8 +17,7 @@ RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/so
&& docker-php-ext-install bz2 gmp imap \ && docker-php-ext-install bz2 gmp imap \
&& pecl install imagick smbclient \ && pecl install imagick smbclient \
&& docker-php-ext-enable imagick smbclient \ && docker-php-ext-enable imagick smbclient \
&& mkdir /var/log/supervisord /var/run/supervisord \ && mkdir /var/log/supervisord /var/run/supervisord
&& echo "*/15 * * * * su - www-data -s /bin/bash -c \"php -f /var/www/html/cron.php\""| crontab -
COPY supervisord.conf /etc/supervisor/supervisord.conf COPY supervisord.conf /etc/supervisor/supervisord.conf

View File

@ -19,4 +19,4 @@ stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0 stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0 stderr_logfile_maxbytes=0
command=cron -f command=/cron.sh

View File

@ -3,7 +3,6 @@ FROM nextcloud:fpm
RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list \ RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list \
&& apt-get update && apt-get install -y \ && apt-get update && apt-get install -y \
supervisor \ supervisor \
cron \
ffmpeg \ ffmpeg \
libmagickwand-dev \ libmagickwand-dev \
libgmp3-dev \ libgmp3-dev \
@ -18,8 +17,7 @@ RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/so
&& docker-php-ext-install bz2 gmp imap \ && docker-php-ext-install bz2 gmp imap \
&& pecl install imagick smbclient \ && pecl install imagick smbclient \
&& docker-php-ext-enable imagick smbclient \ && docker-php-ext-enable imagick smbclient \
&& mkdir /var/log/supervisord /var/run/supervisord \ && mkdir /var/log/supervisord /var/run/supervisord
&& echo "*/15 * * * * su - www-data -s /bin/bash -c \"php -f /var/www/html/cron.php\""| crontab -
COPY supervisord.conf /etc/supervisor/supervisord.conf COPY supervisord.conf /etc/supervisor/supervisord.conf

View File

@ -19,4 +19,4 @@ stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0 stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0 stderr_logfile_maxbytes=0
command=cron -f command=/cron.sh

View File

@ -6,7 +6,10 @@ RUN set -ex; \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
rsync \ rsync \
bzip2 \ bzip2 \
busybox-static \
; \ ; \
mkdir -p /var/spool/cron/crontabs; \
echo '*/15 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data; \
# install the PHP extensions we need # install the PHP extensions we need
# see https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html # see https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html
\ \
@ -86,7 +89,7 @@ RUN set -ex; \
mkdir -p /usr/src/nextcloud/custom_apps; \ mkdir -p /usr/src/nextcloud/custom_apps; \
chmod +x /usr/src/nextcloud/occ chmod +x /usr/src/nextcloud/occ
COPY docker-entrypoint.sh /entrypoint.sh COPY *.sh /
COPY config/* /usr/src/nextcloud/config/ COPY config/* /usr/src/nextcloud/config/
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

4
11.0/apache/cron.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
set -e
exec busybox crond -f -l 0 -L /dev/stdout

View File

@ -6,7 +6,10 @@ RUN set -ex; \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
rsync \ rsync \
bzip2 \ bzip2 \
busybox-static \
; \ ; \
mkdir -p /var/spool/cron/crontabs; \
echo '*/15 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data; \
# install the PHP extensions we need # install the PHP extensions we need
# see https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html # see https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html
\ \
@ -85,7 +88,7 @@ RUN set -ex; \
mkdir -p /usr/src/nextcloud/custom_apps; \ mkdir -p /usr/src/nextcloud/custom_apps; \
chmod +x /usr/src/nextcloud/occ chmod +x /usr/src/nextcloud/occ
COPY docker-entrypoint.sh /entrypoint.sh COPY *.sh /
COPY config/* /usr/src/nextcloud/config/ COPY config/* /usr/src/nextcloud/config/
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

4
11.0/fpm/cron.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
set -e
exec busybox crond -f -l 0 -L /dev/stdout

View File

@ -6,7 +6,10 @@ RUN set -ex; \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
rsync \ rsync \
bzip2 \ bzip2 \
busybox-static \
; \ ; \
mkdir -p /var/spool/cron/crontabs; \
echo '*/15 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data; \
# install the PHP extensions we need # install the PHP extensions we need
# see https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html # see https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html
\ \
@ -86,7 +89,7 @@ RUN set -ex; \
mkdir -p /usr/src/nextcloud/custom_apps; \ mkdir -p /usr/src/nextcloud/custom_apps; \
chmod +x /usr/src/nextcloud/occ chmod +x /usr/src/nextcloud/occ
COPY docker-entrypoint.sh /entrypoint.sh COPY *.sh /
COPY config/* /usr/src/nextcloud/config/ COPY config/* /usr/src/nextcloud/config/
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

4
12.0/apache/cron.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
set -e
exec busybox crond -f -l 0 -L /dev/stdout

View File

@ -6,7 +6,10 @@ RUN set -ex; \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
rsync \ rsync \
bzip2 \ bzip2 \
busybox-static \
; \ ; \
mkdir -p /var/spool/cron/crontabs; \
echo '*/15 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data; \
# install the PHP extensions we need # install the PHP extensions we need
# see https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html # see https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html
\ \
@ -85,7 +88,7 @@ RUN set -ex; \
mkdir -p /usr/src/nextcloud/custom_apps; \ mkdir -p /usr/src/nextcloud/custom_apps; \
chmod +x /usr/src/nextcloud/occ chmod +x /usr/src/nextcloud/occ
COPY docker-entrypoint.sh /entrypoint.sh COPY *.sh /
COPY config/* /usr/src/nextcloud/config/ COPY config/* /usr/src/nextcloud/config/
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

4
12.0/fpm/cron.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
set -e
exec busybox crond -f -l 0 -L /dev/stdout

View File

@ -6,7 +6,10 @@ RUN set -ex; \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
rsync \ rsync \
bzip2 \ bzip2 \
busybox-static \
; \ ; \
mkdir -p /var/spool/cron/crontabs; \
echo '*/15 * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data; \
# install the PHP extensions we need # install the PHP extensions we need
# see https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html # see https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html
\ \
@ -85,7 +88,7 @@ RUN set -ex; \
mkdir -p /usr/src/nextcloud/custom_apps; \ mkdir -p /usr/src/nextcloud/custom_apps; \
chmod +x /usr/src/nextcloud/occ chmod +x /usr/src/nextcloud/occ
COPY docker-entrypoint.sh /entrypoint.sh COPY *.sh /
COPY config/* /usr/src/nextcloud/config/ COPY config/* /usr/src/nextcloud/config/
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

4
docker-cron.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
set -e
exec busybox crond -f -l 0 -L /dev/stdout

View File

@ -51,8 +51,10 @@ for latest in "${latests[@]}"; do
s/%%VARIANT_EXTRAS%%/'"${extras[$variant]}"'/g; s/%%VARIANT_EXTRAS%%/'"${extras[$variant]}"'/g;
' "$version/$variant/Dockerfile" ' "$version/$variant/Dockerfile"
# Copy the docker-entrypoint. # Copy the shell scripts
cp docker-entrypoint.sh "$version/$variant/docker-entrypoint.sh" for name in entrypoint cron; do
cp "docker-$name.sh" "$version/$variant/$name.sh"
done
# Copy the config directory # Copy the config directory
cp -rT .config "$version/$variant/config" cp -rT .config "$version/$variant/config"