Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for arbitrary command during polling #34

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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