From 825b5750d9b0cc00f8c5376b28e26e70557a6b34 Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Wed, 9 Feb 2022 13:25:07 +0100 Subject: [PATCH] nextcloud: Fix subfolder sync Newer nextcloudcmd only allows passing base url as server. Subfolders have to be passed via a --path argument. --- nextcloud/nextcloud-inotify-sync | 11 +++++++---- nextcloud/nextcloud-vimwiki-sync.service | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/nextcloud/nextcloud-inotify-sync b/nextcloud/nextcloud-inotify-sync index e310352..d124904 100755 --- a/nextcloud/nextcloud-inotify-sync +++ b/nextcloud/nextcloud-inotify-sync @@ -21,7 +21,7 @@ after some period, whatever happens first. The nextcloudcmd is called with netrc for login. Usage: - $0 [OPTIONS] source_dir server_url + $0 [OPTIONS] source_dir server_url [ARGS...] $0 -h OPTIONS: @@ -30,9 +30,10 @@ OPTIONS: -s Silent, be less verbose -t SECS Sync period if nothing changed locally. Default: 180 + ARGS Passed to nextcloudcmd EXAMPLE - $0 ~/.vimwiki https://cloud.example.com/remote.php/webdav/vimwiki + $0 ~/.vimwiki https://cloud.example.com --path vimwiki EOF } @@ -41,7 +42,7 @@ IWAIT_OPTS="" SILENT=0 ONESHOT=0 -PERIOD=180 +PERIOD=600 while getopts "host:" OPTION; do case "${OPTION}" in @@ -70,6 +71,8 @@ shift $((OPTIND-1)) SOURCE_DIR=$1 SERVER_URL=$2 +shift +shift if [ -z "${SOURCE_DIR}" ] ; then echo "No source directory given." @@ -83,7 +86,7 @@ if [ -z "${SERVER_URL}" ] ; then exit 1 fi -NCC_OPTS="${NCC_OPTS} ${SOURCE_DIR} ${SERVER_URL}" +NCC_OPTS="${NCC_OPTS} $@ ${SOURCE_DIR} ${SERVER_URL}" while true; do echo "About to sync..." diff --git a/nextcloud/nextcloud-vimwiki-sync.service b/nextcloud/nextcloud-vimwiki-sync.service index 8233141..d20b2b8 100644 --- a/nextcloud/nextcloud-vimwiki-sync.service +++ b/nextcloud/nextcloud-vimwiki-sync.service @@ -4,7 +4,7 @@ Wants=network-online.target After=network-online.target [Service] -ExecStart=%h/.local/bin/nextcloud-inotify-sync %h/.vimwiki "https://cloud.example.org/remote.php/webdav/vimwiki" +ExecStart=%h/.local/bin/nextcloud-inotify-sync %h/.vimwiki "https://cloud.example.com" --path vimwiki Restart=always RestartSec=10min -- 2.30.2