From ff714776321087f86879a47aa6f895af22eb82c0 Mon Sep 17 00:00:00 2001 From: Robert Dailey Date: Mon, 26 Oct 2020 13:55:10 -0500 Subject: [PATCH] Do not replace built-in scripts When the user mounts /cron-scripts in the container, this replaced the built-in scripts. The built-in scripts are now shipped in /cron-scripts-builtin now. --- Dockerfile | 2 +- README.md | 9 ++++----- .../run-cron-php.sh | 0 scripts/cron-tasks.sh | 11 ++++++++--- 4 files changed, 13 insertions(+), 9 deletions(-) rename scripts/{cron-scripts => cron-scripts-builtin}/run-cron-php.sh (100%) diff --git a/Dockerfile b/Dockerfile index 87a1883..d66d773 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ ENV NEXTCLOUD_EXEC_SHELL=bash ENV NEXTCLOUD_EXEC_SHELL_ARGS=-c COPY scripts/*.sh / -COPY scripts/cron-scripts /cron-scripts +COPY scripts/cron-scripts-builtin /cron-scripts-builtin ENTRYPOINT ["tini", "--", "/entrypoint.sh"] diff --git a/README.md b/README.md index 59c3214..d8e17b3 100644 --- a/README.md +++ b/README.md @@ -148,9 +148,8 @@ in addition to the default `cron.php` task. To add your custom tasks, follow the php -f /var/www/html/cron.php ``` -2. Mount this shell script inside the `/cron-scripts` directory. You may also choose to *replace* - this directory, but bear in mind that you will not be running the built-in cron tasks in that - case. Here's an example if you're using `docker-compose.yml`: +2. Mount this shell script inside the `/cron-scripts` directory. Here's an example if you're using + `docker-compose.yml`: ```yml services: @@ -164,8 +163,8 @@ in addition to the default `cron.php` task. To add your custom tasks, follow the interval. Multiple scripts are supported. The container will search for all `*.sh` files inside the -`/cron-scripts` directory. To make supporting multiple scripts easier, you can also map a directory -on the host to the `/cron-scripts` directory in the container: +`/cron-scripts` directory inside the container. To make supporting multiple scripts easier, you can +also map a directory on the host to the `/cron-scripts` directory in the container: ```yml services: diff --git a/scripts/cron-scripts/run-cron-php.sh b/scripts/cron-scripts-builtin/run-cron-php.sh similarity index 100% rename from scripts/cron-scripts/run-cron-php.sh rename to scripts/cron-scripts-builtin/run-cron-php.sh diff --git a/scripts/cron-tasks.sh b/scripts/cron-tasks.sh index 597f675..c4d9c9e 100755 --- a/scripts/cron-tasks.sh +++ b/scripts/cron-tasks.sh @@ -28,8 +28,13 @@ run_scripts_in_dir() { } # Loop through all shell scripts and execute the contents of those scripts in the Nextcloud -# container. It's done this way so that the user may mount more scripts to be executed in addition -# to the default ones. -run_scripts_in_dir /cron-scripts +# container. +run_scripts_in_dir /cron-scripts-builtin + +# If the user has mounted their own scripts, execute those as well. These are optional. It's done +# this way so that the user may mount more scripts to be executed in addition to the default ones. +if [[ -d /cron-scripts ]]; then + run_scripts_in_dir /cron-scripts +fi echo "> Done"