Have you thought of using autofs?

This will automatically mount/unmount shares as you need them.