How to unmount from a script that runs on the mount point that needs to be unmounted?
How would you go about unmounting a mount point from a script that runs on said mount point?
It is clearly not possible with a plain:
umount /mnt
since this will immediately unmount the mount point, which will fail with the output
Device busy ...
In case you need to cut the branch the script is sitting on use:
umount -l
which entails:
-l Lazy unmount. Detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy anymore. (Requires kernel 2.4.11 or later.)