From d072fb4934e345c89d70a392ce7eef54f04fcbca Mon Sep 17 00:00:00 2001 From: Kenneth Jorgensen Date: Sat, 21 Aug 2021 14:27:01 +0900 Subject: [PATCH 1/3] Implemented arbitrary command during polling. --- docker-entrypoint.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 8bad853..808aaad 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 chmod 755 /opt/dropbox/Dropbox @@ -111,5 +116,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 From 7aeb1439652aa321564e009d9d97fd22703905f3 Mon Sep 17 00:00:00 2001 From: Kenneth Jorgensen Date: Sat, 21 Aug 2021 14:50:51 +0900 Subject: [PATCH 2/3] Readme. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 77c5090..270082a 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,10 @@ 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. + - `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 From dab16a363fa744b4e59e9d5223a1c66cf2874d64 Mon Sep 17 00:00:00 2001 From: Kenneth Jorgensen Date: Sat, 21 Aug 2021 15:13:54 +0900 Subject: [PATCH 3/3] Added polling check example. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 270082a..8522cb4 100644 --- a/README.md +++ b/README.md @@ -171,7 +171,8 @@ 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. +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