Restic mount with script

After migrating all the old backups I want to make them available via samba by using restic mount

In my script I have

restic backup 
restic mount

But the script never finishes back to prompt - instead it stops with

When finished, quit with Ctrl-c or umount the mountpoint

What am I doing wrong here?

Nothing. restic mount must continue to run in order to serve the contents of that directory.

If you want to run it in the background, you could use:

nohup restic mount >restic-mount.log 2>&1

Though this will not work unless you supply the password using --password-file, --password-command, or the RESTIC_PASSWORD environment variable since it won’t be attached to the terminal to be able to ask for the password interactively.

If you intend this to run all the time as a service, it may be better to create a systemd unit for it.

Note that if you may need to run with --allow-other if you are sharing the mountpoint with Samba, unless smbd is running as the same user (unlikely).

Thanks for the tip!
Since I’m calling if from a script another & at the end of the command was needed.
Everything runs now as expected: unmount, backup, mount, script exit + mount continues

mount takes a shared lock, the same as backup. You don’t have to unmount first.