Rclone serve systemd

I'm trying to setup a systemd service to start my rclone serve http, but it just timeouts after the start, but it did start?

Can someone take a look and see what could be wrong here:

[Unit]
Description=Rclone VFS Mount
After=network-online.target

[Service]
User=root
Group=root
Type=notify
ExecStartPre=/bin/sleep 10
ExecStart=/usr/bin/rclone serve http disk:/backup \
  --config=/root/.config/rclone/rclone.conf \
  --addr :80 \
  --no-modtime \
  --user XXXXX \
  --pass XXXXXX \
  --vfs-read-chunk-size 10M \
  --vfs-read-chunk-size-limit 0 \
  --timeout=11m \
  --contimeout 3m \
  --log-level INFO \
  --log-file /opt/rclone.log 
ExecStop=/bin/kill $(pidof rclone)
KillMode=none
RestartSec=5

[Install]
WantedBy=default.target

It fails because of a timeout, but I can see from the log file that it started serving files.

Can you show the log?

There's nothing wrong in the logs. It just starts as normal, but I think somehow systemd it's thinking it's timing out.

2020/07/28 06:14:21 DEBUG : rclone: Version "v1.52.2-133-g9058ec32-beta" starting with parameters ["/usr/bin/rclone" "serve" "http" "disk:/backup" "--config=/root/.config/rclone/rclone.conf" "--addr" ":80" "--no-modtime" "--user" "xxxxx" "--pass" "xxxx" "--vfs-read-chunk-size" "10M" "--vfs-read-chunk-size-limit" "0" "--timeout=11m" "--contimeout" "3m" "--log-level" "DEBUG" "--log-file" "/opt/rclone.log"]
2020/07/28 06:14:21 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2020/07/28 06:14:21 INFO : Using --user random42jand01 --pass XXXX as authenticated user
2020/07/28 06:14:21 INFO : Local file system at /backup: poll-interval is not supported by this remote
2020/07/28 06:14:21 DEBUG : Adding path "vfs/forget" to remote control registry
2020/07/28 06:14:21 DEBUG : Adding path "vfs/refresh" to remote control registry
2020/07/28 06:14:21 DEBUG : Adding path "vfs/poll-interval" to remote control registry
2020/07/28 06:14:21 NOTICE: Local file system at /backup: Serving on http://[::]:80/

It's more of a systemd question with rclone, than a issue with rclone I think

I think this is related to the type of the service as of here https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type=

But since I don't know the behavior of rclone after it completes, I don't know which one it would be appropriate. I just went with notify because it's what I use for the mount

Ah, you don't want notify - rclone has special support for that in the mount which isn't in the serve command. Probably simple is the right one I think. I think that is the default so you can leave the line out completely.

This is my final service file if It can help other people too:

[Unit]
Description=Rclone VFS Mount
After=network-online.target

[Service]
User=root
Group=root
Type=simple
ExecStartPre=/bin/sleep 10
ExecStart=/usr/bin/rclone serve http disk:/backup \
  --config=/root/.config/rclone/rclone.conf \
  --addr :80 \
  --no-modtime \
  --user xxxx \
  --pass xxxxx \
  --vfs-read-chunk-size 10M \
  --vfs-read-chunk-size-limit 0 \
  --timeout=11m \
  --contimeout 3m \
  --log-level INFO \
  --log-file /opt/rclone.log 
RestartSec=5
LimitNOFILE=infinity

[Install]
WantedBy=default.target
1 Like

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