Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion 32/apache/cron.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/bin/sh
set -eu

exec busybox crond -f -L /dev/stdout
crontabs=/var/spool/cron/crontabs

if [ -n "${NEXTCLOUD_CRON_SCHEDULE:-}" ]; then
crontabs="${TMPDIR:-/tmp}/nextcloud-crontabs"
mkdir -p "$crontabs"
echo "$NEXTCLOUD_CRON_SCHEDULE php -f /var/www/html/cron.php" > "$crontabs/www-data"
fi

exec busybox crond -f -L /dev/stdout -c "$crontabs"
10 changes: 9 additions & 1 deletion 32/fpm-alpine/cron.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/bin/sh
set -eu

exec busybox crond -f -L /dev/stdout
crontabs=/var/spool/cron/crontabs

if [ -n "${NEXTCLOUD_CRON_SCHEDULE:-}" ]; then
crontabs="${TMPDIR:-/tmp}/nextcloud-crontabs"
mkdir -p "$crontabs"
echo "$NEXTCLOUD_CRON_SCHEDULE php -f /var/www/html/cron.php" > "$crontabs/www-data"
fi

exec busybox crond -f -L /dev/stdout -c "$crontabs"
10 changes: 9 additions & 1 deletion 32/fpm/cron.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/bin/sh
set -eu

exec busybox crond -f -L /dev/stdout
crontabs=/var/spool/cron/crontabs

if [ -n "${NEXTCLOUD_CRON_SCHEDULE:-}" ]; then
crontabs="${TMPDIR:-/tmp}/nextcloud-crontabs"
mkdir -p "$crontabs"
echo "$NEXTCLOUD_CRON_SCHEDULE php -f /var/www/html/cron.php" > "$crontabs/www-data"
fi

exec busybox crond -f -L /dev/stdout -c "$crontabs"
10 changes: 9 additions & 1 deletion 33/apache/cron.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/bin/sh
set -eu

exec busybox crond -f -L /dev/stdout
crontabs=/var/spool/cron/crontabs

if [ -n "${NEXTCLOUD_CRON_SCHEDULE:-}" ]; then
crontabs="${TMPDIR:-/tmp}/nextcloud-crontabs"
mkdir -p "$crontabs"
echo "$NEXTCLOUD_CRON_SCHEDULE php -f /var/www/html/cron.php" > "$crontabs/www-data"
fi

exec busybox crond -f -L /dev/stdout -c "$crontabs"
10 changes: 9 additions & 1 deletion 33/fpm-alpine/cron.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/bin/sh
set -eu

exec busybox crond -f -L /dev/stdout
crontabs=/var/spool/cron/crontabs

if [ -n "${NEXTCLOUD_CRON_SCHEDULE:-}" ]; then
crontabs="${TMPDIR:-/tmp}/nextcloud-crontabs"
mkdir -p "$crontabs"
echo "$NEXTCLOUD_CRON_SCHEDULE php -f /var/www/html/cron.php" > "$crontabs/www-data"
fi

exec busybox crond -f -L /dev/stdout -c "$crontabs"
10 changes: 9 additions & 1 deletion 33/fpm/cron.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/bin/sh
set -eu

exec busybox crond -f -L /dev/stdout
crontabs=/var/spool/cron/crontabs

if [ -n "${NEXTCLOUD_CRON_SCHEDULE:-}" ]; then
crontabs="${TMPDIR:-/tmp}/nextcloud-crontabs"
mkdir -p "$crontabs"
echo "$NEXTCLOUD_CRON_SCHEDULE php -f /var/www/html/cron.php" > "$crontabs/www-data"
fi

exec busybox crond -f -L /dev/stdout -c "$crontabs"
10 changes: 9 additions & 1 deletion 34/apache/cron.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/bin/sh
set -eu

exec busybox crond -f -L /dev/stdout
crontabs=/var/spool/cron/crontabs

if [ -n "${NEXTCLOUD_CRON_SCHEDULE:-}" ]; then
crontabs="${TMPDIR:-/tmp}/nextcloud-crontabs"
mkdir -p "$crontabs"
echo "$NEXTCLOUD_CRON_SCHEDULE php -f /var/www/html/cron.php" > "$crontabs/www-data"
fi

exec busybox crond -f -L /dev/stdout -c "$crontabs"
10 changes: 9 additions & 1 deletion 34/fpm-alpine/cron.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/bin/sh
set -eu

exec busybox crond -f -L /dev/stdout
crontabs=/var/spool/cron/crontabs

if [ -n "${NEXTCLOUD_CRON_SCHEDULE:-}" ]; then
crontabs="${TMPDIR:-/tmp}/nextcloud-crontabs"
mkdir -p "$crontabs"
echo "$NEXTCLOUD_CRON_SCHEDULE php -f /var/www/html/cron.php" > "$crontabs/www-data"
fi

exec busybox crond -f -L /dev/stdout -c "$crontabs"
10 changes: 9 additions & 1 deletion 34/fpm/cron.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/bin/sh
set -eu

exec busybox crond -f -L /dev/stdout
crontabs=/var/spool/cron/crontabs

if [ -n "${NEXTCLOUD_CRON_SCHEDULE:-}" ]; then
crontabs="${TMPDIR:-/tmp}/nextcloud-crontabs"
mkdir -p "$crontabs"
echo "$NEXTCLOUD_CRON_SCHEDULE php -f /var/www/html/cron.php" > "$crontabs/www-data"
fi

exec busybox crond -f -L /dev/stdout -c "$crontabs"
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ A safe home for all your data. Access & share your files, calendars, contacts, m
- [Custom Data directory (`datadirectory`)](#custom-data-directory-datadirectory)
- [Trusted domains (`trusted_domains`)](#trusted-domains-trusted_domains)
- [Image specific](#image-specific)
- [Background jobs (`cron.php`)](#background-jobs-cronphp)
- [Redis Memory Caching](#redis-memory-caching)
- [E-mail (SMTP) Configuration](#e-mail-smtp-configuration)
- [Object Storage (Primary Storage)](#object-storage-primary-storage)
Expand Down Expand Up @@ -281,6 +282,18 @@ You might want to make sure the htaccess is up to date after each container upda

- `NEXTCLOUD_INIT_HTACCESS` (not set by default) Set it to true to enable run `occ maintenance:update:htaccess` after container initialization.

### Background jobs (`cron.php`)

The images ship a `/cron.sh` entrypoint that runs `php -f /var/www/html/cron.php` every 5 minutes via busybox `crond`. To run the background jobs less often, override the schedule with a standard five-field cron expression:

- `NEXTCLOUD_CRON_SCHEDULE` (default: `*/5 * * * *`) Cron expression for `cron.php`.

```console
$ docker run -d --volumes-from app -e NEXTCLOUD_CRON_SCHEDULE='*/30 * * * *' --entrypoint /cron.sh nextcloud
```

Note that Nextcloud's admin overview reports a warning once the last background job ran more than an hour ago, and jobs such as calendar event reminders are delayed by up to one interval. `TZ` applies to the schedule, so it is evaluated in the container's local time.

### Redis Memory Caching

To use Redis for memory caching as well as PHP session storage, specify the following values and also add a [Redis](https://hub.docker.com/_/redis/) container to your stack. See the [examples](https://github.com/nextcloud/docker/tree/master/.examples) for further instructions.
Expand Down
10 changes: 9 additions & 1 deletion docker-cron.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/bin/sh
set -eu

exec busybox crond -f -L /dev/stdout
crontabs=/var/spool/cron/crontabs

if [ -n "${NEXTCLOUD_CRON_SCHEDULE:-}" ]; then
crontabs="${TMPDIR:-/tmp}/nextcloud-crontabs"
mkdir -p "$crontabs"
echo "$NEXTCLOUD_CRON_SCHEDULE php -f /var/www/html/cron.php" > "$crontabs/www-data"
fi

exec busybox crond -f -L /dev/stdout -c "$crontabs"