The following issues were addressed. Note that these are edge cases.
* If an empty `/cron-scripts` directory was mounted in the container, an
error would occur.
* If files in the `/cron-scripts` directory had spaces in the name, this
would cause issues.
* stdin was held open when running `docker exec` which would cause hangs
and other issues. The `exec` command is now run non-interactively.
* Custom scripts that failed would interrupt processing of scripts after
it, if any.
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.
It is now possible to override and explicitly specify the shell you
would like used when executing cron tasks. This is accomplished with the
NEXTCLOUD_EXEC_SHELL environment variable, which defaults to bash. You
can also override and customize the arguments provided to that shell
executable via NEXTCLOUD_EXEC_SHELL_ARGS, which defaults to "-c".
See documentation for more detail and examples.
Fixes#6
* New DEBUG environment variable enables `set -x` in shell scripts for
extra verbose output for debugging custom cron scripts and to assist
with development of the core scripts.
* Verify if we can find the Nextcloud container on start up. Fail if
not.
* Print information about how we will search for Nextcloud on start up.
* During cron task execution, the ID of the Nextcloud container is
printed, if found.
If the Nextcloud container is recreated while the cronjob container is still running, the ID of the
container is obtained each time the cron tasks are executed. Previously it was cached on entrypoint,
so if the ID changed this container would fail.
New NEXTCLOUD_EXEC_USER environment variable added which allows control over which
user is used to execute cron tasks inside the Nextcloud container. By default, the
user is `www-data`. If the environment variable is specified but empty, no `--user`
option is provided to `docker exec`.
Mount individual shell scripts (with the `*.sh` extension) inside `/cron-scripts/` in the
container. The cron daemon will automatically run these scripts inside the Nextcloud
container for you. Write the scripts as if they will run in the Nextcloud container
itself.