Saturday, March 10, 2012

Time Machine

    Working with Mac osX's Time Machine is suppose to be painless and easy. I suppose that would be true "if" you only used external hard drive's connected to a USB port. But what if your part of an organization? What if you just don't have the desktop real-estate to place a large, bulky, black brick of a drive? What if you just (here is the keyword) "want" your backups stored somewhere else?

    You can, goto my first post of March 2012 and get things setup, but if you are already there, you may have noticed something. Time Machine makes incremental backups every hour. Normally, this is a good thing. This is especially important if you are in "mission-critical" environments.

    Time machine was never intended for large scale networks. It was built to do one thing; to provide easy backups to a single user on a single system. It does this task very well. Mostly.

    Once again, I just have to be different. Rather than go to the expense of having multiple massive black boxes cluttering both my wife and I's desk's, I setup a single hard drive across my local network. So far this has been a good thing, but not without its own issues. You see, I have discovered something, something I don't like.

    Lets say I am moving one of my larger files to my server for sharing to the rest of the network. These tend to be anywhere from 650Mb to a couple of gigabytes. Before I setup Time Machine on the Mac's, this was not an issue and would only take a couple of minutes to copy the file. Now, if I try the same thing, and both Mac's are preforming their hourly backup, this same file copy can take upwards of thirty minutes. There are times when Time Machine just seems to be almost running constantly.

    What I need then, is a way to schedule Time Machine backups, preferably when I am not at the computer.

    Normally, if you are using an external USB Hard Drive and it happens to not be plugged in, Time Machine will save all of the backups locally until the Time Machine Hard Drive becomes available. It would be nice to have this type of functionality across the network, but it is not an absolute must.

    However, there are some options.

    Idea #1: Just shut off time machine until I am done for the day. Then, just turn it on and let it do its thing until I get back to my Mac the next day. Not a prefect solution, but it is one way. It only requires me to remember to turn it on and off each time. Personally, I don't like this. The idea behind Time Machine is that it is supposed to be so easy that you never have to think about it.

    Idea #2: If you open a Finder Window to the folder /System/Library/LaunchDeamons you will find a file called Look for the section called "Start Interval", it should be set to 3600. There are 3600 seconds in one hour. By changing this value you can change how often Time Machine will auto run its backup. You just can't change when the timer starts. The counter starts automatically as soon as you boot your Mac.

    Idea #3: Use Applescript and iCal to schedule when to turn Time Machine on and off. This also has the advantage of allowing me turn Time Machine on when I feel I need to make a backup. I think this will fit the bill nicely, and is the way I intend to go.

    To do this, I first need to create a new Calendar in iCal. Well, I don't actually "need" to, it will just make it handy to have a separate calendar just for applescripts. This will allow me to keep all of my scheduled tasks in one place and not interfere with my normal iCal calendars. I called my new calendar  "Automator" and have it "On My Mac".

    Before we proceed with iCal, we need to setup Applescript. First, Open Applescript Editor and Time Machine Preferences.

    In the Applescript Editor, type:

          do shell script "/System/Library/CoreServices/backupd.bundle/Contents/Resources/bakupd-helper &"

    Now save your new "Applescript" to your desktop. The "Applications" folder is read-only, but after saving to the desktop you can move it. I saved mine in "Applications/Utilities/Automator Apps". What ever you choose is fine, just remember to keep it out of the way of more frequently used apps while placing it somewhere you will remember.

    Now, shut off Time Machine in Time Machine Preferences. Don't worry, we are just disabling the automatic backup. You icon will still spin when it is working.

    Back to iCal. Create a new "event" and set the following options:

        Uncheck "All-Day"
        Set start/stop time, an hour or so around 3am should work fine.
        repeat everyday, or as often as you wish.
        end: never
        show as free. You don't want to cause a conflict with anything else you may have going on.
        choose your calendar to host it in.
        alert: Run Script. When you select this you will be given an option to load your script from wherever you saved it. Do so. Also make sure you set it to 10-15 minutes after the alert. Not before.

    That's it. Just save your calendar and go. If you want to test it, just double-click the script and you will see Time Machine still works, even if the icon is a little greyed out. If you have any questions or comments, please post them below.

    Until next time ...

No comments:

Post a Comment