34 lines
1,023 B
SYSTEMD
34 lines
1,023 B
SYSTEMD
|
# User service for Rclone mounting
|
||
|
#
|
||
|
# Place in ~/.config/systemd/user/
|
||
|
# File must include the '@' (ex rclone@.service)
|
||
|
# As your normal user, run
|
||
|
# systemctl --user daemon-reload
|
||
|
# You can now start/enable each remote by using rclone@<remote>
|
||
|
# systemctl --user enable rclone@dropbox
|
||
|
# systemctl --user start rclone@dropbox
|
||
|
|
||
|
[Unit]
|
||
|
Description=rclone: Remote FUSE filesystem for cloud storage config %i
|
||
|
Documentation=man:rclone(1)
|
||
|
After=network-online.target
|
||
|
Wants=network-online.target
|
||
|
|
||
|
[Service]
|
||
|
Type=notify
|
||
|
Environment="EXPRESSION=%i"
|
||
|
ExecStart= \
|
||
|
bash -c ' \
|
||
|
target="${EXPRESSION%%":"*}"; \
|
||
|
dirname="${EXPRESSION#*":"}"; \
|
||
|
mkdir -p "%h/$dirname"; \
|
||
|
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: "%h/$dirname"'
|
||
|
ExecStop=bash -c '/bin/fusermount -u "%h/${EXPRESSION#*":"}"'
|
||
|
|
||
|
[Install]
|
||
|
WantedBy=default.target
|