I was noticing that when i did systemctl stop vfs it was not doing a clean shutdown, the rclone logs didn't say the usual signal received, exiting, etc
I noticed that I had this in my systemd:
ExecStop=/bin/fusermount -uz /mnt/remote
I removed this, and then a systemctl stop vfs was doing a clean shutdown like the logs says:
2025/04/06 01:30:50 INFO : Signal received: terminated
2025/04/06 01:30:50 ERROR : /mnt/remote: Unmounted rclone mount
2025/04/06 01:30:50 INFO : Exiting...
But then when looking at systemctl status vfs there was this weird error
systemctl status vfs
× vfs.service - Rclone VFS Mount
Loaded: loaded (/etc/systemd/system/vfs.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2025-04-06 01:29:08 -03; 13s ago
Process: 1610978 ExecStartPre=/bin/sleep 120 (code=exited, status=0/SUCCESS)
Process: 1611463 ExecStart=/usr/bin/rclone mount --config=/home/lol/.config/rclone/rclone.conf --allow-other --cache-dir=/mnt/cache --vfs-cache-max-age=8766h --vfs-cache-max-size=17.8T --vfs-cache-mode=full --vfs-cache-min-free-space=5G --vfs-read-chunk-size=0 --buffer-size=0 --vfs-read-ahead=256M --vfs>
Main PID: 1611463 (code=exited, status=143)
Status: "[01:28] vfs cache: objects 0 (was 0) in use 0, to upload 0, uploading 0, total size 0 (was 0)"
CPU: 207ms
Apr 06 01:26:27 V27 systemd[1]: Starting Rclone VFS Mount...
Apr 06 01:28:27 V27 systemd[1]: Started Rclone VFS Mount.
Apr 06 01:29:08 V27 systemd[1]: Stopping Rclone VFS Mount...
Apr 06 01:29:08 V27 systemd[1]: vfs.service: Main process exited, code=exited, status=143/n/a
Apr 06 01:29:08 V27 systemd[1]: vfs.service: Failed with result 'exit-code'.
Apr 06 01:29:08 V27 systemd[1]: Stopped Rclone VFS Mount.
So my fix was adding SuccessExitStatus=143 on my service.
Am I doing something wrong or this is expected? Can I trust that rclone is getting killed cleanly if it logs Exiting ?
This is my full systemd
[Unit]
Description=Rclone VFS Mount
RequiresMountsFor=/mnt/cache
After=mnt-cache.mount
Requires=mnt-cache.mount
[Service]
User=root
Group=root
Type=notify
ExecStartPre=/bin/sleep 1
ExecStart=/usr/bin/rclone mount \
lots of stuff
cf: /mnt/remote
SuccessExitStatus=143
LimitNOFILE=infinity
TimeoutSec=1500
[Install]
WantedBy=default.target
Not sure it matters but I'm running rclone v1.69.1, I also believe the backends doesn't matter so I'm not posting them since this is all systemd stuff.
It seems it was a deliberate choice by the rclone team to exit with this status code like java does correct?