Okay. So I have a few executable .sh files that backup a directory. In this case, the Development directory. I have two computers. A Mac (Which is the main computer, and a Windows 7 desktop.) Since my Mac only has 500 GB of storage, I want to back up data to the other computer. I do this wirelessly.
To accomplish this, I have a shell script which checks whether I am connected to main-pc/Users/Public/. I know that the location isn't secure, and I will change the location in a few days, but for now, I just want it to work.
Overall the script works fine, it makes sure the location exists, if I am not connected I have it set up to mount the computer. It copies everything correctly as well.
EXCEPT, if the internet suddenly loses connections, or my connection to the other computer is interrupted (Which happens every now and then). When this happens, the location suddenly doesn't exist, and it keeps running the script, but does nothing and just does things like
x -> y Location does not exist... Blah blah blah.
My question is, how can I make sure that if I were to lose connection, it simply just pauses the backup and waits till the location connects? Is this even possible? I can't just recreate the location, as I am not storing this locally.
Thanks. (And I realize it would be easier to just get an external drive, but what is the fun in that?)
My script is pretty long, but here is the section that concerns the backup.
rm -r -v /Volumes/Users/Public/InfiniteBackups/Development cd /Volumes/Users/Public/InfiniteBackups mkdir Development cp -v -f -rip ~/Development/ /Volumes/Users/Public/InfiniteBackups/Development echo "Files have finished transferring" say "Files have finished transferring" exit 0
It is not the prettiest looking script, but it works. This is on OS X 10.8.