OSX / Samba - How do I automatically remount / reconnect to drives that have been disconnected?
Add some code to check for the mounts and to try and remount them if needed - here's some (snipped bits) from a Linux backup bash script (sorry, no OSX to hand at the moment) - it might give you some pointers and maybe someone will post an OSX equivalent too:
thishost='myhostname'
#
mountpoint='/root/mybackup'
#
mountoptions='-o username=bkuplinux,domain=mydomain,password=mypassword'
#
sharename='//ssc4/linux'
#
emailtarget='[email protected]'
###################################
# End of user editable variables
###################################
backupfolder=$mountpoint/$thishost
if [ $(mount | grep -c $mountpoint) != 1 ]; then
echo "$mountpoint mount is not present - trying to mount..."
mount -t cifs $sharename $mountpoint $mountoptions
if [ $(mount | grep -c $mountpoint) != 1 ]; then
echo "$mountpoint mount is still not present - quitting"
if [ "$emailtarget" != "" ]; then
echo "$mountpoint mount is not present on $thishost so backup cannot continue" | mail -s "$thishost backup problem" $emailtarget
fi
exit 1
fi
fi