Auto mount rclone

I've been wanting to mount my rclone drives automatically with the help of systemd ( which can be found at rclone wiki) .

Here my code after systemctl cat

/etc/systemd/system/anime.service

[Unit]
Description=Google Drive (rclone)
AssertPathIsDirectory=/root/Anime

[Service]

Type=simple
ExecStart=/usr/bin/rclone mount
--config=/root/.config/rclone/rclone.conf \ --allow-other
--cache-tmp-upload-path=/tmp/rclone/upload
--cache-chunk-path=/tmp/rclone/chunks \ --cache-workers=8
--cache-writes \ --cache-dir=/tmp/rclone/vfs
--cache-db-path=/tmp/rclone/db \ --no-modtime
--drive-use-trash \ --stats=0 \ --checkers=16 \ --bwlimit=4000M
\ --dir-cache-time=60m \ --cache-info-age=60m Anime: /root/Anime

ExecStop=/bin/fusermount -u /root/Anime
Restart=always
RestartSec=5

[Install]
WantedBy=default.target

I found this code and tried it , made some tweakings. Still not working. I'm a beginner rightnow therefore cannot get it to work. Can someone find the error here.

I've done everything such as daemon-reload and systemctl enable and start the service. It's not working.

Thanks

hello and welcome to the forum,

hard to share good advice, there was a template of questions to be answered that help us to help you.

that command is using a lot of old, deprecated flags.
and --checkers does nothing on a rclone mount

first make sure you can run the command on the command line.
once that is working, try systemd.

and if you want a good systemd, this is it
https://github.com/animosity22/homescripts/blob/master/systemd/rclone-drive.service

and please enclose text with three backticks so it is formatted correctly

[Unit]
Description=RClone Service
Wants=network-online.target
After=network-online.target

[Service]
Type=notify
Environment=RCLONE_CONFIG=/opt/rclone/rclone.conf
KillMode=none
RestartSec=5
ExecStart=/usr/bin/rclone mount gcrypt: /GD \

Job for xxxxx.service failed because the control process exited with error code.
See "systemctl status xxxxx.service" and "journalctl -xe" for details.

Getting this error after using the code from the GitHub link. I tried checking the journlctl -xe log , and found nothing.

fwiw, make sure your rclone mount command works on the command line.

post the full rclone debug log, enclosed with three backticks so it is formatted like so

2022/11/04 17:56:51 DEBUG : rclone: Version "v1.58.1" starting with parameters ["C:\\data\\rclone\\rclone.exe" "mount" "hetznersbox01_sftp_crypt:" "b:\\rclone\\mount\\hetznersbox01_sftp_crypt+cache" "--rc" "--rc-addr=localhost:6011" "--vfs-cache-mode=full" "--dir-cache-time=5000m" "--vfs-cache-max-age=5000m" "--cache-dir=d:\\rclone\\cache\\hetznersbox01_sftp_crypt+cache" "--log-level=DEBUG" "--log-file=.\\\\log.mount.hetznersbox01_sftp_crypt+cache.txt"]
2022/11/04 17:56:51 NOTICE: Serving remote control on http://localhost:6011/
2022/11/04 17:56:51 DEBUG : Creating backend with remote "hetznersbox01_sftp_crypt:"
2022/11/04 17:56:51 DEBUG : Using config file from "C:\\data\\rclone\\rclone.conf"
2022/11/04 17:56:51 DEBUG : Creating backend with remote "hetznersbox01_sftp:store"

Yeah the rclone mount works for me if run seperately. But the problem that I'm facing is that I cannot start the systemctl.

ok,
with the systemd, test with a simple command, for example something like
ExecStart=/usr/bin/rclone version

also, this need a trailing slash
ExecStart=/usr/bin/rclone mount
with multi-line ExecStart, each line needs a trailing slash, except for the last line

Yeah it worked but also an error occured.

     Loaded: loaded (/etc/systemd/system/testr.service; static; vendor preset: >     Active: failed (Result: protocol) since Sat 2022-11-05 15:48:51 UTC; 17s a>    Process: 72713 ExecStart=/usr/bin/rclone version (code=exited, status=0/SUC>   Main PID: 72713 (code=exited, status=0/SUCCESS)
Nov 05 15:48:51 dgdevansh systemd[1]: Starting test service...
Nov 05 15:48:51 dgdevansh rclone[72713]: rclone v1.50.2
Nov 05 15:48:51 dgdevansh rclone[72713]: - os/arch: linux/amd64
Nov 05 15:48:51 dgdevansh rclone[72713]: - go version: go1.13.8
Nov 05 15:48:51 dgdevansh systemd[1]: testr.service: Failed with result 'protoc>Nov 05 15:48:51 dgdevansh systemd[1]: Failed to start test serv```

ok, good, as the rclone command is working, now to focus on the systemd part

that version of rclone is many years old,
update to latest stable v1.60.0 and try again.

and post the updated systemd file that uses rclone version

     Loaded: loaded (/etc/systemd/system/webseries.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sat 2022-11-05 16:12:44 UTC; 1s ago
    Process: 88562 ExecStart=/usr/bin/rclone mount --allow-other Webseries: /Webseries (code=exited, st>   Main PID: 88562 (code=exited, status=1/FAILURE)```


With rclone update to version 1.60

ok, now add -vv for rclone debug output

could be an issue with --allow-other, maybe need to edit /etc/fuse.conf
or dir/file permissions.

Finally . Solved the problem. It's working now .
Thank you soooo so much :fire:.

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