diff --git a/contrib/docker/entrypoint.sh b/contrib/docker/entrypoint.sh index b85f3334..0471a040 100755 --- a/contrib/docker/entrypoint.sh +++ b/contrib/docker/entrypoint.sh @@ -34,9 +34,20 @@ else fi # Default parameters -ARGS=(--monitor --confdir /onedrive/conf --syncdir /onedrive/data) +ARGS=(--confdir /onedrive/conf --syncdir /onedrive/data) echo "# Base Args: ${ARGS}" +# Tell client to use Standalone Mode, based on an environment variable. Otherwise Monitor Mode is used. +if [ "${ONEDRIVE_SYNC_ONCE:=0}" == "1" ]; then + echo "# We run in Standalone Mode" + echo "# Adding --sync" + ARGS=(--sync ${ARGS[@]}) +else + echo "# We run in Monitor Mode" + echo "# Adding --monitor" + ARGS=(--monitor ${ARGS[@]}) +fi + # Make Verbose output optional, based on an environment variable if [ "${ONEDRIVE_VERBOSE:=0}" == "1" ]; then echo "# We are being verbose" diff --git a/docs/docker.md b/docs/docker.md index 789781a1..e2ae5dd2 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -287,6 +287,7 @@ docker run $firstRun --restart unless-stopped --name onedrive -v onedrive_conf:/ | ONEDRIVE_DISABLE_UPLOAD_VALIDATION | Controls "--disable-upload-validation" option. Default is 0 | 1 | | ONEDRIVE_SYNC_SHARED_FILES | Controls "--sync-shared-files" option. Default is 0 | 1 | | ONEDRIVE_RUNAS_ROOT | Controls if the Docker container should be run as the 'root' user instead of 'onedrive' user. Default is 0 | 1 | +| ONEDRIVE_SYNC_ONCE | Controls if the Docker container should be run in Standalone Mode. It will use Monitor Mode otherwise. Default is 0 | 1 | ### Environment Variables Usage Examples **Verbose Output:** diff --git a/docs/podman.md b/docs/podman.md index 6bdd5bc6..8877581d 100644 --- a/docs/podman.md +++ b/docs/podman.md @@ -304,6 +304,7 @@ podman run -it --name onedrive_work --user "${ONEDRIVE_UID}:${ONEDRIVE_GID}" \ | ONEDRIVE_DISABLE_UPLOAD_VALIDATION | Controls "--disable-upload-validation" option. Default is 0 | 1 | | ONEDRIVE_SYNC_SHARED_FILES | Controls "--sync-shared-files" option. Default is 0 | 1 | | ONEDRIVE_RUNAS_ROOT | Controls if the Docker container should be run as the 'root' user instead of 'onedrive' user. Default is 0 | 1 | +| ONEDRIVE_SYNC_ONCE | Controls if the Docker container should be run in Standalone Mode. It will use Monitor Mode otherwise. Default is 0 | 1 | ### Environment Variables Usage Examples **Verbose Output:**