I want to run a service which automatically mounts my gdrive
What is your rclone version (output from rclone version)
v1.53.1
Which OS you are using and how many bits (eg Windows 7, 64 bit)
Debian 10
Which cloud storage system are you using? (eg Google Drive)
Google drive
The command you were trying to run (eg rclone copy /tmp remote:tmp)
I mount the gdrive with the following command: rclone mount gdrive: /home/iragoiko/gdrive --allow-other --dir-cache-time 96h --vfs-cache-max-age 48h --vfs-read-chunk-size 20M --vfs-read-chunk-size-limit 1G --buffer-size 10M --umask 002 --log-file /home/iragoiko/rclone.log
Now I want to create a service, this is my rclone.service file:
root@debian:/etc/systemd/system# systemctl start rclone.service
Warning: The unit file, source configuration file or drop-ins of rclone.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Job for rclone.service failed because the control process exited with error code.
See "systemctl status rclone.service" and "journalctl -xe" for details.
Warning: The unit file, source configuration file or drop-ins of rclone.service changed on disk. Run 'systemctl daemon-reload' to reload uni
● rclone.service - rclone
Loaded: loaded (/etc/systemd/system/rclone.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2020-10-24 19:47:22 CEST; 6min ago
Process: 3047 ExecStart=/usr/bin/rclone rclone mount gdrive: /home/iragoiko/gdrive --allow-other --dir-cache-time 96h --vfs-cache-max-age
Main PID: 3047 (code=exited, status=1/FAILURE)
oct 24 19:47:22 debian systemd[1]: Started rclone.
oct 24 19:47:22 debian rclone[3047]: Error: unknown command "rclone" for "rclone"
oct 24 19:47:22 debian rclone[3047]: Run 'rclone --help' for usage.
oct 24 19:47:22 debian rclone[3047]: 2020/10/24 19:47:22 Fatal error: unknown command "rclone" for "rclone"
oct 24 19:47:22 debian systemd[1]: rclone.service: Main process exited, code=exited, status=1/FAILURE
oct 24 19:47:22 debian systemd[1]: rclone.service: Failed with result 'exit-code'.
Looks like it is working, thanks for your support @asdffdsa .
For my understanding, will this service mount at reboot automatically before plex docker is running?
Thanks for your reply. I have set the following rclone.service
[Unit]
Description=RClone Service
Wants=network-online.target
After=network-online.target
[Service]
Type=notify
Environment=RCLONE_CONFIG=/home/iragoiko/.config/rclone.conf
ExecStart=/usr/bin/rclone mount gdrive: /home/iragoiko/gdrive \
# This is for allowing users other than the user running rclone access to the mount
--allow-other \
# Google Drive is a polling remote so this value can be set very high and any changes are detected via polling.
--dir-cache-time 96h \
# The log level output
--log-level INFO \
# Location of the log file
--log-file /home/iragoiko/rclone/rclone.log \
# I reduce the poll interval down to 15 seconds as this makes changes appear fast the API quotas per day are huge
--poll-interval 15s \
# This is setting the file permission on the mount to user and group have the same access and other can read
--umask 002 \
# The local disk used for caching
--cache-dir=/cache \
# This is used for caching files to local disk for streaming
--vfs-cache-mode full \
# This limits the cache size to the value below
--vfs-cache-max-size 30G \
# This limits the age in the cache if the size is reached and it removes the oldest files first
--vfs-cache-max-age 336h \
# This sets up the remote control daemon so you can issue rc commands locally
--rc \
ExecStop=/bin/fusermount -uz /home/iragoiko/gdrive
Restart=on-success
RestartSec=5
[Install]
WantedBy=multi-user.target
Y run the service and this is the status log
rclone.service - RClone Service
Loaded: loaded (/etc/systemd/system/rclone.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2020-10-24 22:37:38 CEST; 16s ago
Process: 8507 ExecStart=/usr/bin/rclone mount gdrive: /home/iragoiko/gdrive --allow-other --dir-cache-time 96h --log-level INFO --log-file /home
Main PID: 8507 (code=exited, status=1/FAILURE)
oct 24 22:37:38 debian rclone[8507]: --vfs-write-wait duration Time to wait for in-sequence write before giving error. (defau
oct 24 22:37:38 debian rclone[8507]: --volname string Set the volume name (not supported by all OSes).
oct 24 22:37:38 debian rclone[8507]: --write-back-cache Makes kernel buffer writes before sending them to rclone. With
oct 24 22:37:38 debian rclone[8507]: Use "rclone [command] --help" for more information about a command.
oct 24 22:37:38 debian systemd[1]: rclone.service: Main process exited, code=exited, status=1/FAILURE
oct 24 22:37:38 debian rclone[8507]: Use "rclone help flags" for to see the global flags.
oct 24 22:37:38 debian rclone[8507]: Use "rclone help backends" for a list of supported services.
oct 24 22:37:38 debian rclone[8507]: 2020/10/24 22:37:38 Fatal error: unknown shorthand flag: 'z' in -z
oct 24 22:37:38 debian systemd[1]: rclone.service: Failed with result 'exit-code'.
oct 24 22:37:38 debian systemd[1]: Failed to start RClone Service.
root@debian:/etc/systemd/system# systemctl status rclone.service
● rclone.service - RClone Service
Loaded: loaded (/etc/systemd/system/rclone.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2020-10-24 22:51:00 CEST; 6s ago
Process: 9209 ExecStart=/usr/bin/rclone mount gdrive: /home/iragoiko/gdrive (code=exited, status=1/FAILURE)
Main PID: 9209 (code=exited, status=1/FAILURE)
oct 24 22:51:00 debian systemd[1]: Starting RClone Service...
oct 24 22:51:00 debian rclone[9209]: 2020/10/24 22:51:00 NOTICE: Config file "/home/iragoiko/.config/rclone.conf" not found - using defaults
oct 24 22:51:00 debian rclone[9209]: 2020/10/24 22:51:00 Failed to create file system for "gdrive:": didn't find section in config file
oct 24 22:51:00 debian systemd[1]: rclone.service: Main process exited, code=exited, status=1/FAILURE
oct 24 22:51:00 debian systemd[1]: rclone.service: Failed with result 'exit-code'.
oct 24 22:51:00 debian systemd[1]: Failed to start RClone Service.
root@debian:/etc/systemd/system#
If I run with my user
iragoiko@debian:~$ systemctl status rclone.service
● rclone.service - RClone Service
Loaded: loaded (/etc/systemd/system/rclone.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2020-10-24 22:53:41 CEST; 15s ago
Process: 9386 ExecStart=/usr/bin/rclone mount gdrive: /home/iragoiko/gdrive (code=exited, status=1/FAILURE)
Main PID: 9386 (code=exited, status=1/FAILURE)
iragoiko@debian:~$