Add extra logs and debugging features
* 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.
This commit is contained in:
parent
5d63bb14e4
commit
08ec92f509
3 changed files with 25 additions and 0 deletions
|
@ -77,6 +77,10 @@ how this all works.
|
||||||
in the tasks being executed using the Nextcloud container's running user. Specifically, the
|
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.
|
`--user` option will *not* be provided to the `docker exec` command.
|
||||||
|
|
||||||
|
* `DEBUG`<br>
|
||||||
|
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
|
## Container Health
|
||||||
|
|
||||||
If you do `docker-compose ps`, you will see the active health of the container. The following logic
|
If you do `docker-compose ps`, you will see the active health of the container. The following logic
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
[[ ! -z "$DEBUG" ]] && set -x
|
||||||
|
|
||||||
echo "-------------------------------------------------------------"
|
echo "-------------------------------------------------------------"
|
||||||
echo " Executing Cron Tasks: $(date)"
|
echo " Executing Cron Tasks: $(date)"
|
||||||
|
@ -20,6 +21,8 @@ if [[ -z "$containerId" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "> Nextcloud Container ID: ${containerId}"
|
||||||
|
|
||||||
# Loop through all shell scripts and execute the contents of those scripts in the Nextcloud
|
# 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
|
# container. It's done this way so that the user may mount more scripts to be executed in addition
|
||||||
# to the default ones.
|
# to the default ones.
|
||||||
|
|
|
@ -1,11 +1,29 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
[[ ! -z "$DEBUG" ]] && set -x
|
||||||
|
|
||||||
if [[ -z "$NEXTCLOUD_CONTAINER_NAME" ]]; then
|
if [[ -z "$NEXTCLOUD_CONTAINER_NAME" ]]; then
|
||||||
echo "NEXTCLOUD_CONTAINER_NAME is a required variable"
|
echo "NEXTCLOUD_CONTAINER_NAME is a required variable"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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" \
|
echo "*/$NEXTCLOUD_CRON_MINUTE_INTERVAL * * * * /cron-tasks.sh" \
|
||||||
> /var/spool/cron/crontabs/root
|
> /var/spool/cron/crontabs/root
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue