Improve the rclone service

This commit is contained in:
Manuel Thalmann 2024-01-16 21:39:25 +01:00
parent b1bf448aa1
commit 12b54d0e24

View file

@ -9,15 +9,15 @@ ExecStart= \
bash -c ' \ bash -c ' \
target="${EXPRESSION%%":"*}"; \ target="${EXPRESSION%%":"*}"; \
dirname="${EXPRESSION#*":"}"; \ dirname="${EXPRESSION#*":"}"; \
destination="%h/.mnt/$dirname"; \ destination="$(realpath -m --relative-base "%h/.mnt" "$dirname")"; \
mkdir -p "$destination"; \ mkdir -p "$destination"; \
mkdir -p /tmp/rclone; \ mkdir -p /tmp/rclone; \
/usr/bin/rclone mount \ /usr/bin/rclone mount \
--config=%h/.config/rclone/rclone.conf \ --config="%h/.config/rclone/rclone.conf" \
--vfs-cache-mode full \ --vfs-cache-mode full \
--log-file /tmp/rclone/$target.log \ --log-file /tmp/rclone/$target.log \
$target: "$destination";' $target: "$destination";'
ExecStop=bash -c '/bin/fusermount -zu "%h/${EXPRESSION#*":"}"' ExecStop=bash -c '/bin/fusermount -zu "$(realpath --relative-base "%h/.mnt" "${EXPRESSION#*":"}")"'
Restart=always Restart=always
RestartSec=10 RestartSec=10