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"