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

27 lines
784 B
SYSTEMD
Raw Normal View History

2022-11-10 17:24:02 +00:00
[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#*":"}"; \
2024-01-16 20:39:25 +00:00
destination="$(realpath -m --relative-base "%h/.mnt" "$dirname")"; \
2023-05-03 16:31:38 +00:00
mkdir -p "$destination"; \
2022-11-10 17:24:02 +00:00
mkdir -p /tmp/rclone; \
/usr/bin/rclone mount \
2024-01-16 20:39:25 +00:00
--config="%h/.config/rclone/rclone.conf" \
2022-11-10 17:24:02 +00:00
--vfs-cache-mode full \
--log-file /tmp/rclone/$target.log \
2023-05-03 16:31:38 +00:00
$target: "$destination";'
2024-01-16 20:39:25 +00:00
ExecStop=bash -c '/bin/fusermount -zu "$(realpath --relative-base "%h/.mnt" "${EXPRESSION#*":"}")"'
2022-11-10 17:24:02 +00:00
2023-04-07 12:49:41 +00:00
Restart=always
RestartSec=10
2023-04-07 14:26:32 +00:00
[Install]
WantedBy=rclone.target