mirror of
https://github.com/nextcloud/docker.git
synced 2025-04-21 03:06:08 +02:00
Replace crond with a while loop.
Adding the cron command to /var/spool/cron/crontabs/www-data assumes that cron, and by extension the nextcloud app, is run as 'www-data'. 'crond' cannot be used with: exec "echo \"*/%%CRONTAB_INT%% * * * * php -f /var/www/html/cron.php\" | crontab - && crond -f -l 0 -L /dev/stdout" because that assumes the uid used matches a entry in '/etc/passwd'. Signed-off-by: Roland Vet <vet.roland@gmail.com>
This commit is contained in:
parent
e26adedbdb
commit
0c7ef56635
4 changed files with 10 additions and 8 deletions
|
@ -7,8 +7,7 @@ RUN set -ex; \
|
|||
rsync \
|
||||
; \
|
||||
\
|
||||
rm /var/spool/cron/crontabs/root; \
|
||||
echo '*/%%CRONTAB_INT%% * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data
|
||||
rm /var/spool/cron/crontabs/root
|
||||
|
||||
# install the PHP extensions we need
|
||||
# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html
|
||||
|
|
|
@ -10,10 +10,7 @@ RUN set -ex; \
|
|||
busybox-static \
|
||||
libldap-common \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*; \
|
||||
\
|
||||
mkdir -p /var/spool/cron/crontabs; \
|
||||
echo '*/%%CRONTAB_INT%% * * * * php -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# install the PHP extensions we need
|
||||
# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
exec busybox crond -f -l 0 -L /dev/stdout
|
||||
while [ 1 ]; do
|
||||
(php -f /var/www/html/cron.php &);
|
||||
sleep %%CRONTAB_INT%%m;
|
||||
done
|
||||
|
|
|
@ -111,7 +111,6 @@ function create_variant() {
|
|||
s/%%MEMCACHED_VERSION%%/'"${pecl_versions[memcached]}"'/g;
|
||||
s/%%REDIS_VERSION%%/'"${pecl_versions[redis]}"'/g;
|
||||
s/%%IMAGICK_VERSION%%/'"${pecl_versions[imagick]}"'/g;
|
||||
s/%%CRONTAB_INT%%/'"$crontabInt"'/g;
|
||||
' "$dir/Dockerfile"
|
||||
|
||||
case "$phpVersion" in
|
||||
|
@ -132,6 +131,10 @@ function create_variant() {
|
|||
for name in entrypoint cron; do
|
||||
cp "docker-$name.sh" "$dir/$name.sh"
|
||||
done
|
||||
# Replace the variable.
|
||||
sed -ri -e '
|
||||
s/%%CRONTAB_INT%%/'"$crontabInt"'/g;
|
||||
' "$dir/cron.sh"
|
||||
|
||||
# Copy the upgrade.exclude
|
||||
cp upgrade.exclude "$dir/"
|
||||
|
|
Loading…
Add table
Reference in a new issue