Run RClone as startup failed

Hey,

I want to run RClone Mount Service at startup, and when I’m gonna add the correct user i’m getting this error

● manage-rclone.service - Mount all RClone drives
Loaded: loaded (/etc/systemd/system/manage-rclone.service; enabled; preset: disabled)
Active: activating (auto-restart) (Result: exit-code) since Sun 2023-12-24 14:31:37 CET; 6s ago
Process: 25867 ExecStart=/usr/bin/rclone --vfs-cache-mode writes mount MyMountDrive: ~/MyMountDrive --config /home/tobi>
Main PID: 25867 (code=exited, status=1/FAILURE)
CPU: 95ms

Here is my config file:

[Unit]
Description=Mount all RClone drives
AssertPathIsDirectory=~/MyMountDrive
After=network-online.target

[Service]
Type=simple
User=tobias
Group=tobias
ExecStart= /usr/bin/rclone --vfs-cache-mode  writes mount MyMountDrive: ~/MyMountDrive --config /home/tobias/.config/rclone/rclone.conf
ExecStop=/bin/fusermount -u ~/MyMountDrive
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

When i’m run this command just in my terminal, it’s working :confused:

Does someone knows the error?

Hi @NachoImperium,

AFAIK you should use absolute paths in units, not relative or with aliases, like yours with the ~.

Hope this helps!

1 Like

Hello @NachoImperium :wink:

Try this:

File: ~/.config/systemd/user/mount-rclone.service

[Unit]
Description=Mount all RClone drives
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
ExecStartPre=-/usr/bin/mkdir -p %h/MyMountDrive
ExecStart=/usr/bin/rclone mount \
--vfs-cache-mode writes \
--config %h/.config/rclone/rclone.conf \
--umask 022 \
--allow-other \
MyMountDrive:%h/MyMountDrive
ExecStop=/bin/fusermount -u %h/MyMountDrive
Restart=always
RestartSec=10

[Install]
WantedBy=default.target

Or probably use this template: Rclone systemd user service · GitHub

Run it: systemctl --user start mount-rclone.service

1 Like

Hey,

sorry for my late reply, I don’t have this directory:

~/.config/systemd/user/mount-rclone.service

Only “~/.config/” this exists.

The path is correct and if it doesn’t exist, then what would one do? One would create the folders. Or?

1 Like

Just FYI, I also use rclone, and:

$ stat ~/.config/systemd/user/mount-rclone.service
stat: cannot statx '/home/mirdarthos/.config/systemd/user/mount-rclone.service': No such file or directory

i think it has to be created first…