Remount if service fails

Assertion failed on job is what i get when my rclone mount just stops without any errors in the log and i try service drive restart
What i want to do is have the service auto restart if it fails
this is my service

Description=drive
AssertPathIsDirectory=/mnt/drive
After=network-online.target

[Service]
Type=simple
ExecStart=/usr/bin/rclone mount drive: /mnt/drive --allow-other --read-only --config=/root/.config/rclone/rclone.conf --log-file=/var/log/rclone.log
ExecStop=/bin/fusermount -uz /mnt/drive
Restart=always
RestartSec=3
ExecStartPre=/bin/sleep 10

[Install]
WantedBy=default.target```

If systemd fails, that would restart it.

That being said, I've never had the mount fail though.

You'd want to capture the failure via debug logs and know why it fails rather than just restarting it.

oh mine fails quite often
i'll change the log level to debug to show you

2019/06/30 16:21:36 DEBUG : &{media/movies/Black Swan (2010)/Black Swan (2010).mkv (r)}: >Read: read=131072, err=<nil>
2019/06/30 16:21:36 DEBUG : &{media/movies/Black Swan (2010)/Black Swan (2010).mkv (r)}: Read: len=4096, offset=65536
2019/06/30 16:21:36 DEBUG : media/movies/Black Swan (2010)/Black Swan (2010).mkv: ChunkedReader.Read at 68153344 length 1048576 chunkOffset 0 chunkSize 134217728
2019/06/30 16:21:36 DEBUG : media/movies/Black Swan (2010)/Black Swan (2010).mkv: ChunkedReader.Read at 69201920 length 1048576 chunkOffset 0 chunkSize 134217728
2019/06/30 16:21:36 DEBUG : media/movies/Black Swan (2010)/Black Swan (2010).mkv: ReadFileHandle.seek from 327680 to 65536 (fs.RangeSeeker)
2019/06/30 16:21:36 DEBUG : media/movies/Black Swan (2010)/Black Swan (2010).mkv: ChunkedReader.RangeSeek from 70250496 to 65536 length -1
2019/06/30 16:21:36 DEBUG : media/movies/Black Swan (2010)/Black Swan (2010).mkv: ChunkedReader.Read at -1 length 4096 chunkOffset 65536 chunkSize 134217728
2019/06/30 16:21:36 DEBUG : media/movies/Black Swan (2010)/Black Swan (2010).mkv: ChunkedReader.openRange at 65536 length 134217728
2019/06/30 16:21:36 DEBUG : media/movies/Black Swan (2010)/Black Swan (2010).mkv: moving offset set from 0 to 65536
2019/06/30 16:21:36 INFO  : media/movies/Black Swan (2010)/Black Swan (2010).mkv: confirmed reading by external reader
2019/06/30 16:21:36 DEBUG : media/movies/Black Swan (2010)/Black Swan (2010).mkv: scale workers to 4
2019/06/30 16:21:36 DEBUG : media/movies/Black Swan (2010)/Black Swan (2010).mkv: cache reader closed 70250496
2019/06/30 16:21:36 DEBUG : media/movies/Black Swan (2010)/Black Swan (2010).mkv: ChunkedReader.Read at 69632 length 8192 chunkOffset 65536 chunkSize 134217728
2019/06/30 16:21:36 DEBUG : &{media/movies/Black Swan (2010)/Black Swan (2010).mkv (r)}: >Read: read=4096, err=<nil>
2019/06/30 16:21:36 DEBUG : media/movies/The Duke of Burgundy (2014): list: read 1 from source```

and the mount failed

I'm not sure what you mean by the mount failed as there is nothing in the logs to indicate it stopped working.

How do you know it failed?

don't know why
it definitely unmounted the drive
maybe out of memory and the vps just unmounted it because of that
in any case, it stopped failing after i removed the buffer size and chunk total

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