I currently have my Time Machine sparse bundle residing on a network drive plugged in to my router. I have a script that runs at login that auto connects to the shared drive and mounts the sparsebundle image as a device for backups. Here's what it looks like:
try mount volume "smb://readyshare/MacBackup" end try do shell script "hdiutil attach -mountpoint /Volumes/MacBackup/ /Volumes/MacBackup/TimeMachine.sparsebundle"
However, I've noticed that from time the time the device will automatically disconnect itself. Usually this happens when I leave for lunch and the MacBook Pro goes to sleep after a while.
Often I don't notice this until I get an error message about my backup device not being able to perform the backup.
Is there a way I can modify this script (or create a new one) that can detect when my sparsebundle device has been ejected and remount it?