From 54bfb1ee03327729725697951c366cafaef8f6b8 Mon Sep 17 00:00:00 2001 From: ftsell Date: Fri, 4 Oct 2024 22:03:51 +0200 Subject: [PATCH] add custom cron file to nextcloud image --- nextcloud/Dockerfile | 1 + nextcloud/cron.sh | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100755 nextcloud/cron.sh diff --git a/nextcloud/Dockerfile b/nextcloud/Dockerfile index 635b9ce..a850ddb 100644 --- a/nextcloud/Dockerfile +++ b/nextcloud/Dockerfile @@ -75,6 +75,7 @@ RUN ln -sf /opt/config/nginx.conf /etc/nginx/sites-enabled/default; \ RUN chown www-data /opt/config ADD start.sh /usr/local/bin/run +ADD cron.sh /usr/local/bin/cron.sh VOLUME /opt/storage /opt/config /opt/log /opt/static EXPOSE 9787/tcp ENTRYPOINT /usr/local/bin/run diff --git a/nextcloud/cron.sh b/nextcloud/cron.sh new file mode 100755 index 0000000..47cff09 --- /dev/null +++ b/nextcloud/cron.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env sh +set -e + +echo "Preparing environment" +cp /opt/config/config.php /var/www/nextcloud/config/config.php +chown -R www-data /var/www/nextcloud/config /var/www/nextcloud/apps /opt/log +chmod +x ./occ +mkdir -p /run/php +export USER=www-data HOME=/home/www-data + +echo "Syncing system address books with dav" +su -s /var/www/nextcloud/occ www-data dav:sync-system-addressbook + +echo "Running cron.php" +su -s /usr/bin/php www-data /var/www/nextcloud/cron.php +