PortValhalla/scripts/Common/Config/rclone/rclone@.service

26 lines
784 B
Desktop File

[Unit]
Description=rclone: Remote FUSE filesystem for cloud storage config %i
Documentation=man:rclone(1)
[Service]
Type=notify
Environment="EXPRESSION=%i"
ExecStart= \
bash -c ' \
target="${EXPRESSION%%":"*}"; \
dirname="${EXPRESSION#*":"}"; \
destination="$(realpath -m --relative-base "%h/.mnt" "$dirname")"; \
mkdir -p "$destination"; \
mkdir -p /tmp/rclone; \
/usr/bin/rclone mount \
--config="%h/.config/rclone/rclone.conf" \
--vfs-cache-mode full \
--log-file /tmp/rclone/$target.log \
$target: "$destination";'
ExecStop=bash -c '/bin/fusermount -zu "$(realpath --relative-base "%h/.mnt" "${EXPRESSION#*":"}")"'
Restart=always
RestartSec=10
[Install]
WantedBy=rclone.target