Autostart rclone mount using systemd

Create the following file under ~/.config/systemd/user/rclone-dropbox.service:

[Unit]
Description=Dropbox (rclone)
AssertPathIsDirectory=%h/Dropbox
# Make sure we have network enabled
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/rclone mount --vfs-cache-mode full Dropbox: Dropbox
# Perform lazy unmount
ExecStop=/usr/bin/fusermount -zu %h/Dropbox
# Restart the service whenever rclone exists with non-zero exit code
Restart=on-failure
RestartSec=15
[Install]
# Autostart after reboot
WantedBy=default.target

Reload the user services, enable and start the new service:

$ systemctl --user daemon-reload
$ systemctl --user enable --now rclone-dropbox

3 thoughts on “Autostart rclone mount using systemd”

  1. Thanks a lot, saved me a lot of time setting up USER service files, especially looking up which folders, etc.

    Maybe add how to see the logs of each service, like
    journalctl –user -fu your-service-file.service

    and a hint to never use “~” for the home folder because it doesn’t get expanded but treated literally. Also enable user lingering if you want to run user services on reboot.

    Have a great day!

  2. Examine the – before vfs in the ExecStart line. This needs to be a double dash but it looks like something converted it to a special Unicode character. So that code doesn’t work upon copy paste

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.