Rclone automount in Ubuntu

I'm trying to get rclone to automount with Anomosity's setup for plex. When I load it manually, it works like a charm, however, once I start doing the service mount, it goes sideways. One thing I've noticed is it will try and start multiple rclone services it seems.

When I mount without the service start, I use this:
rclone mount gcache: /mnt/gclone
--allow-other
--dir-cache-time 96h
--drive-chunk-size 32M
--log-level INFO
--timeout 1h
--umask 002
--rc

In the service file I use:
[Unit]
Description=RCloneService
Wants=network-online.target
After=network-online.target
StartLimitIntervalSec=0

[Service]
Type=notify
Environment=RCLONE_CONFIG=/root/.config/rclone/rclone.conf

ExecStart=/usr/bin/rclone mount gcache: /mnt/gclone
--config /root/.config/rclone/rclone.conf
--allow-other
--dir-cache-time 96h
--drive-chunk-size 32M
--timeout 1h
--umask 002
--rc
ExecStop=/bin/fusermount -uz /mnt/gclone
Restart=on-failure
RestartSec=1

[Install]
WantedBy=multi-user.target

Fuser Service
[Unit]
Description = /gclone MergerFS mount
After=gmedia-rclone.service
RequiresMountsFor=/mnt

[Mount]
What = /mnt/speed:/mnt/gclone
Where = /
Type = fuse.mergerfs
Options = defaults,sync_read,auto_cache,use_ino,allow_other,func.getattr=newest,category.action=all,category.create=ff

[Install]
WantedBy=multi-user.target

rclone config

[gdrive]
type = drive
client_id = hidden
client_secret = hidden
scope = drive
token =
team_drive =

[gcache]
type = cache
remote = gdrive:
chunk_size = 5M
info_age = 2d
chunk_total_size = 1G

In the service file, what happens if you put the whole ExecStart= line on one line? So something like ExecStart=/usr/bin/rclone mount gcache: /mnt/gclone --config /root/.config/rclone/rclone.conf --allow-other ...?

Also, is that a user service file or a system service file? Note that if you're starting the service as your user, then it won't be able to access the config file...

I think I was intending it to run as root. But I'm a complete novice. Should I be running it as a user versus system? I'm away from my laptop for a moment then I'll change the script and report back. Thanks

When you mount it manually, do you mount it as root or as your normal user? Do the same thing with the systemd service. If it should be run as root, put the service in /etc/systemd/system/. If it should be run as your user, put it in ~/.config/system/user/.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.