diff --git a/systemd/grive-changes@.service.in b/systemd/grive-changes@.service.in index 6b3ca29..172ab19 100644 --- a/systemd/grive-changes@.service.in +++ b/systemd/grive-changes@.service.in @@ -2,7 +2,7 @@ Description=Google drive sync (changed files) [Service] -ExecStart=@GRIVE_SYNC_SH_BINARY@ listen "%I" +ExecStart=@GRIVE_SYNC_SH_BINARY@ listen "%i" Type=simple Restart=always RestartSec=30 diff --git a/systemd/grive-sync.sh b/systemd/grive-sync.sh index 0a7aad3..36ef2e1 100755 --- a/systemd/grive-sync.sh +++ b/systemd/grive-sync.sh @@ -15,13 +15,13 @@ cd ~ ### ARGUMENT PARSING ### SCRIPT="${0}" +DIRECTORY=$(systemd-escape --unescape "$2") -if [[ -z "${2}" ]] || [[ ! -d "${2}" ]] ; then +if [[ -z "$DIRECTORY" ]] || [[ ! -d "$DIRECTORY" ]] ; then echo "Need a directory name in the current users home directory as second argument. Aborting." exit 1 fi -DIRECTORY="$2" if [[ -z "${1}" ]] ; then echo "Need a command as first argument. Aborting." @@ -102,6 +102,7 @@ listen_directory() { do # Use a different call to not need to change exit into return inotifywait -q -r -e modify,attrib,close_write,move,create,delete --exclude ".grive_state|.grive" "${_directory}" > /dev/null 2>&1 && ${SCRIPT} sync "${_directory}" + #echo ${SCRIPT} "${_directory}" done # always exit ok, so that we never go into a wrong systemd state diff --git a/systemd/grive-timer@.service.in b/systemd/grive-timer@.service.in index 56ae8b3..a6aae6a 100644 --- a/systemd/grive-timer@.service.in +++ b/systemd/grive-timer@.service.in @@ -3,4 +3,4 @@ Description=Google drive sync After=network-online.target [Service] -ExecStart=@GRIVE_SYNC_SH_BINARY@ sync "%I" +ExecStart=@GRIVE_SYNC_SH_BINARY@ sync "%i"