How to unmount when automatically mounted at loggin?

Hi Rclone forum members,

I’m new here and new to Rclone and I have a question that I haven’t been able to find an answer for so I hope that maybe somebody here could help me by answering it.

What is best practice regarding automatically mounted Rclone remote as drive on a Mac? Should I unmount the drive before I log off or shutdown?

Currently I’m using LaunchAgents and a .plist file that automatically calls a bash script in /Users/<user>/bin/ at loggin that mounts the drive.

#!/bin/bash

# Log start time
echo "Rclone script Filen started at $(date)"

/usr/local/bin/rclone mount \
    --vfs-read-chunk-size 128M \
    --vfs-cache-mode full \
    --volname Filen \
    fde: ~/.mount/rclone_fde

My question, should I unmout the drive before logging off or shouting down?

Would this be best practice or maybe it doesn't matter if I unmount or not when logging off?

If yes, should i use rclone unmount … or fusermount -u?

How would I go about “catching” log off or shouting down so that I can call a script that unmounts the drive?

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

Filen Cloud drive

I'll let the mods welcome you to the forum and potentially provide a better answer from their experience. @kapitainsky is a Mac user afaik so he might be able to chime in.

What I'm going to say is that you always want to run it without --daemon (which you're already doing) because this lets launchd manage the process properly. On logout/shutdown, launchd will terminate the LaunchAgent, which normally delivers SIGTERM, so the mount should be cleaned up as part of process exit.

With that being said, it's best to just try it out. Close the lid with the mount running, power off the computer, etc and figure out if you need to do something about it. Once you see what happens in each situation you can fire off a query to Claude or GPT and most often than not it will provide a good answer for this type of questions. At least it can give you next steps to try or better stuff to ask about.

As for unmounting, on macOS you want to run umount /path/to/mountpoint or diskutil unmount force /path/to/mountpoint if it's stuck.