Mount and exec?

Is there already an option to execute a command with a mount and clean up afterwards?

I think that would be handy to be used together with tools that expect a local file system. For example

rclone mount some_remote:/valuable_files /mnt/temp –exec="restic backup /mnt/temp"

could be used to backup some remote files using restic, with rclone making sure to clean up the mount when the child process exits. (And also making sure the child process isn't even started if the mount fails.)

hi,

hi, rclone is open source. you are welcome to add the feature yourself.
else might consider writing a bash script or use systemd