Skip to content

Instantly share code, notes, and snippets.

@uGeek
Forked from gmag11/rclone-mount@.service
Created June 7, 2019 20:11
Show Gist options
  • Save uGeek/660a985be0e0f588c7b19a9613655d71 to your computer and use it in GitHub Desktop.
Save uGeek/660a985be0e0f588c7b19a9613655d71 to your computer and use it in GitHub Desktop.
Mount multiple RClone remotes on boot with a single SystemD forking service definition
# Rclone mount on boot
# Copy file to: /lib/systemd/system
# You need to create a remote on RClone and a folder on your disk, both with same name <rclone-remote>
# This example uses /cloud/ folder as origin to mount all remotes, change it to your needs
# This example use a linux user named rclone. Create it or adapt it to your needs. Rclone will get config from that user's home folder
# Register new service by typing:
# sudo systemctl daemon-reload
# Do the next one for every remote you want to load on boot
# sudo systemctl enable rclone-mount@<rclone-remote>.service
# systemctl start rclone-mount@<rclone-remote>.service
# Usage:
# To unmount drive use
# systemctl stop rclone-mount@<rclone-remote>.service
# To mount use:
# systemctl start rclone-mount@<rclone-remote>.service
# To disable mount on boot use:
# systemctl disable rclone-mount@<rclone-remote>.service
[Unit]
Description=rclone FUSE mount for %i
Documentation=http://rclone.org/docs/
After=network-online.target externo.mount
# Mount point in my system is on a USB drive, don't ask why :))), that's why I have to wait for it to get mounted
Requires=externo.mount
[Service]
#Type=forking
# This example use a linux user named rclone. Create it or adapt it to your needs. Rclone will get config from that user's home folder
User=rclone
Group=rclone
# This example uses /cloud/ folder as origin to mount all remotes, change it to your needs
ExecStart=/usr/bin/rclone mount %i: /cloud/%i --vfs-cache-mode full -v --allow-other
ExecStop=/bin/fusermount -uz /cloud/%i
[Install]
#Wants=network-online.target
#Alias=rclone-rs
#RequiredBy=
WantedBy=multi-user.target
@gmag11
Copy link

gmag11 commented Jul 10, 2019

externo.mount en la línea 23 es una configuración específica de mi sistema. La uso porque necesito que el servicio espere a que esté montado el disco externo. Puedes eliminarlo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment