Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Backup across the network to a windows share' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Backup across the network to a windows share
Authored by: hankins on Apr 15, '04 09:17:10PM
Thank you for this hint. It might not be the prettiest GUI-wrapped, brushed-metal solution, but it works great.

I came up with some custom code for the "destinations.conf" file to help me mount and backup to a network share. I work in a Mac & PC environment and have tons of storage available on the PC; therefore, I wanted to automatically mount the Windows share, back up the files from my TiBook, and then unmount the share when done.

This is what I did...

1. Created an applescript to mount the Windows volume without launching the Finder Window. Here's the script:


tell application "Finder"
	mount volume "smb://10.0.1.70/WindowsShare"
end tell

2. Added some conditional code to the "destinations.conf" backup script:

tag|/Volumes/WindowsShare/|osascript /Users/me/Library/Scripts/Networking/ConnectToWindows.scpt;sleep 5;test -d /Volumes/WindowsShare|true

3. When I launch the backup process, I also tack on an unmount command to release the Volume. This is pretty ugly.

sudo rsyncbackup -s sources.daily.conf; disktool -e //USER@SERVER/WINDOWSSHARE
What happens when all is said and done is the script attempts to connect to the Windows share, sleeps a few seconds to complete the transaction, then double-checks to make sure the volume was successfully mounted. If so, it continues on with the backup process. After the backup has completed, the command is given to kill the mount altogether, removing the share icon from the desktop.

I'm 100% sure there are better ways to do all of this, so please pass along any tips. I'm not trying to fool anyone with any kind of "omfg l33t coding skillz" by any means!

FWIW, The only reason I have the applescript mount is because I couldn't successfully figure out how to mount the windows share through the command line. Likewise, the only reason I issue the disktool unmount command as part of the initial backup command is because I couldn't figure out how to insert the code into the actual backup process. Please expand on this idea if you're able to - I'd love to see what other possibilities exist.

[ Reply to This | # ]