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>
#### CRON via supervisor
`apt install supervisor cron` </br>
`apt install supervisor` </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>
`COPY supervisord.conf /etc/supervisor/supervisord.conf` </br>
`CMD ["/usr/bin/supervisord"]` </br>

View File

@ -36,20 +36,7 @@ services:
restart: always
volumes:
- nextcloud:/var/www/html
user: www-data
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'
entrypoint: /cron.sh
depends_on:
- db
- redis

View File

@ -44,20 +44,7 @@ services:
restart: always
volumes:
- nextcloud:/var/www/html
user: www-data
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'
entrypoint: /cron.sh
depends_on:
- db
- redis

View File

@ -40,20 +40,7 @@ services:
restart: always
volumes:
- nextcloud:/var/www/html
user: www-data
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'
entrypoint: /cron.sh
depends_on:
- db
- redis

View File

@ -49,20 +49,7 @@ services:
restart: always
volumes:
- nextcloud:/var/www/html
user: www-data
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'
entrypoint: /cron.sh
depends_on:
- db
- redis

View File

@ -1,12 +1,9 @@
FROM nextcloud:apache
RUN apt-get update && apt-get install -y \
supervisor \
cron \
&& rm -rf /var/lib/apt/lists/*
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 -
supervisor \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir /var/log/supervisord /var/run/supervisord
COPY supervisord.conf /etc/supervisor/supervisord.conf

View File

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

View File

@ -1,12 +1,9 @@
FROM nextcloud:fpm
RUN apt-get update && apt-get install -y \
supervisor \
cron \
&& rm -rf /var/lib/apt/lists/*
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 -
supervisor \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir /var/log/supervisord /var/run/supervisord
COPY supervisord.conf /etc/supervisor/supervisord.conf

View File

@ -19,4 +19,4 @@ stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
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 \
&& apt-get update && apt-get install -y \
supervisor \
cron \
ffmpeg \
libmagickwand-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 \
&& pecl install imagick smbclient \
&& docker-php-ext-enable imagick smbclient \
&& mkdir /var/log/supervisord /var/run/supervisord \
&& echo "*/15 * * * * su - www-data -s /bin/bash -c \"php -f /var/www/html/cron.php\""| crontab -
&& mkdir /var/log/supervisord /var/run/supervisord
COPY supervisord.conf /etc/supervisor/supervisord.conf

View File

@ -19,4 +19,4 @@ stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
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 \
&& apt-get update && apt-get install -y \
supervisor \
cron \
ffmpeg \
libmagickwand-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 \
&& pecl install imagick smbclient \
&& docker-php-ext-enable imagick smbclient \
&& mkdir /var/log/supervisord /var/run/supervisord \
&& echo "*/15 * * * * su - www-data -s /bin/bash -c \"php -f /var/www/html/cron.php\""| crontab -
&& mkdir /var/log/supervisord /var/run/supervisord
COPY supervisord.conf /etc/supervisor/supervisord.conf

View File

@ -19,4 +19,4 @@ stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
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 \
rsync \
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
# 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; \
chmod +x /usr/src/nextcloud/occ
COPY docker-entrypoint.sh /entrypoint.sh
COPY *.sh /
COPY config/* /usr/src/nextcloud/config/
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 \
rsync \
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
# 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; \
chmod +x /usr/src/nextcloud/occ
COPY docker-entrypoint.sh /entrypoint.sh
COPY *.sh /
COPY config/* /usr/src/nextcloud/config/
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 \
rsync \
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
# 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; \
chmod +x /usr/src/nextcloud/occ
COPY docker-entrypoint.sh /entrypoint.sh
COPY *.sh /
COPY config/* /usr/src/nextcloud/config/
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 \
rsync \
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
# 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; \
chmod +x /usr/src/nextcloud/occ
COPY docker-entrypoint.sh /entrypoint.sh
COPY *.sh /
COPY config/* /usr/src/nextcloud/config/
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 \
rsync \
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
# 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; \
chmod +x /usr/src/nextcloud/occ
COPY docker-entrypoint.sh /entrypoint.sh
COPY *.sh /
COPY config/* /usr/src/nextcloud/config/
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;
' "$version/$variant/Dockerfile"
# Copy the docker-entrypoint.
cp docker-entrypoint.sh "$version/$variant/docker-entrypoint.sh"
# Copy the shell scripts
for name in entrypoint cron; do
cp "docker-$name.sh" "$version/$variant/$name.sh"
done
# Copy the config directory
cp -rT .config "$version/$variant/config"