diff --git a/README.md b/README.md index 051d77a..4e0593b 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,11 @@ Needs to be set to a positive integer value. The Dropbox daemon is polled for it which can be configured to reduce load on the system. This is the number in seconds to wait between polling the Dropbox daemon. Defaults to `5`. +- `POLLING_CHECK` +Arbitrary command to execute during polling. This can be used to set up external healtchecks. +Defaults to no command at all. For instance: +`POLLING_CHECK=curl -fsS -m 10 --retry 5 -o /dev/null https://hc-ping.com/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` + - `SKIP_SET_PERMISSIONS` If this is set to `true`, the container skips setting the permissions on all files in the `/opt/dropbox` folder in order to prevent long startup times. _Note:_ please make sure to have correct permissions on all files before diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 8e5d8ba..e26fd60 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -47,6 +47,11 @@ else chown -R ${DROPBOX_UID}:${DROPBOX_GID} /opt/dropbox fi +# Set default polling check command. +if [[ -z "$POLLING_CHECK" ]]; then + POLLING_CHECK="true" +fi + # Change permissions on Dropbox folder [[ -d /opt/dropbox/Dropbox ]] && chmod 755 /opt/dropbox/Dropbox @@ -144,5 +149,6 @@ sleep 5 while kill -0 ${DROPBOX_PID} 2> /dev/null; do [ -d "/proc/${DROPBOX_PID}" ] && [ -f "/opt/dropbox/.dropbox/info.json" ] && gosu dropbox dropbox status /usr/bin/find /tmp/ -maxdepth 1 -type d -mtime +1 ! -path /tmp/ -exec rm -rf {} \; + $POLLING_CHECK || echo "Polling check failed" /bin/sleep ${POLLING_INTERVAL} done