diff --git a/README.md b/README.md index f214362..e5169ff 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,10 @@ how this all works. in the tasks being executed using the Nextcloud container's running user. Specifically, the `--user` option will *not* be provided to the `docker exec` command. +* `DEBUG`
+ Enables more verbose logging in core scripts. Useful only for development. To get more verbose + output in your own custom cron scripts, use `set -x` in the actual script. + ## Container Health If you do `docker-compose ps`, you will see the active health of the container. The following logic diff --git a/scripts/cron-tasks.sh b/scripts/cron-tasks.sh index f10fe18..e4c886b 100755 --- a/scripts/cron-tasks.sh +++ b/scripts/cron-tasks.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash set -e +[[ ! -z "$DEBUG" ]] && set -x echo "-------------------------------------------------------------" echo " Executing Cron Tasks: $(date)" @@ -20,6 +21,8 @@ if [[ -z "$containerId" ]]; then exit 1 fi +echo "> Nextcloud Container ID: ${containerId}" + # 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. diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index d2a23e1..6351879 100755 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -1,11 +1,29 @@ #!/usr/bin/env bash set -e +[[ ! -z "$DEBUG" ]] && set -x if [[ -z "$NEXTCLOUD_CONTAINER_NAME" ]]; then echo "NEXTCLOUD_CONTAINER_NAME is a required variable" exit 1 fi +# Print info about how we will look for Nextcloud +if [[ -n "$NEXTCLOUD_PROJECT_NAME" ]]; then + echo "Will search for Nexcloud container as a Docker Compose service" + echo "Project: $NEXTCLOUD_PROJECT_NAME, Service: $NEXTCLOUD_CONTAINER_NAME" +else + echo "Container Name: $NEXTCLOUD_CONTAINER_NAME" +fi + +# Do an initial search for the container to rule out any configuration problems +containerId="$(/find-container.sh)" +if [[ -z "$containerId" ]]; then + echo "ERROR: Unable to find the Nextcloud container" + exit 1 +else + echo "Found Nextcloud container with ID $containerId" +fi + echo "*/$NEXTCLOUD_CRON_MINUTE_INTERVAL * * * * /cron-tasks.sh" \ > /var/spool/cron/crontabs/root