Restart rclone automatically

What is the problem you are having with rclone?

It seems rclone serve died on me for unknown reasons (which led to some backups failing). Now I wonder whether there is any best practice for monitoring pcloud and restarting it when it no longer is active.

Note: I am not trying to figure out why rclone quit. I assume it was a user error while I was fiddling with other stuff on the server or it was some upgrade that interfered, it doesn't really matter here. The point is that I have a cron job that automatically starts rclone serve at startup, but I have nothing that automatically issues the command when rclone fails while the server is up.

Run the command 'rclone version' and share the full output of the command.

rclone v1.60.0
- os/version: debian 11.5 (64 bit)
- os/kernel: 5.15.39-3-pve (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.19.2
- go/linking: static
- go/tags: none

Which cloud storage system are you using? (eg Google Drive)

pCloud

The command you were trying to run (eg rclone copy /tmp remote:tmp)

Paste command here

The rclone config contents with secrets removed.

rclone serve sftp pcloud:Backup/ --addr :2022 --user username --pass pswd 

Just wondering why you are using rclone mount for backup?

I think best practice now-a-days would be to make a systemd unit with restart on fail set, eg

[Service]
Restart=on-failure
RestartSec=5s

You'll find lots of examples for systemd units in the forum or on the rclone wiki.

I'm using rclone serve because the webDAV implementation of my cloud storage provider (pcloud) is extremely and their native app has also proven to be unreliable (including data loss). The only reliable way of accessing pcloud for backups (using duplicacy) has been pcloud serve.

Thanks, that is exactly what I was looking for!

So if I setup a systemd service as described in

will my cron job (rclone selfupdate --stable) still work with rclone running as a service or do I need to adjust something?

Assuming that the systemd unit is using the same rclone binary then it should work fine I think.

Note that systemd has a cron replacement too - I haven't dived down that particular rabbit hole but I know it is popular!

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