Trigger an action when time machine finishes a back-up

I would like to start a Time Machine back-up to an attached external drive (Drobo) and when it completes, shut down my laptop. Is this possible using something like an AppleScript or directly with KM?

You could do something like I described in the post linked below whereby Time Machine is activated and then, in my case, a user-configured delay is used before unmounting the drive. You could do similar, just adjust the delay appropriate for your setup and then replace the unmount action with a Shut Down action.

Thanks NaOH that looks interesting, is it possible to download your macro?


Here you go. It should be disabled and if it matches my setup it will be placed in a macro group called Background Processes. I added some comments in places to note where the name of the backup disk needs to be changed for your system.

Time Machine 2 Backup.kmmacros (10.7 KB)

Edit: I'm running OS X 10.11, so I can't promise these scripts work on newer versions of the Mac OS because I haven't tested.

I have imported your macro and will try to tweak it to 'eject' my Drobo back-up drive on completion and let you know how I get on.

I had already found how to automate starting the process and my Apple script will use whichever external drive is connected at that time, it maybe useful to others so here it is :-

tell application "System Events" to tell process "SystemUIServer"
set tm to (first menu bar item whose description is "Time Machine") of menu bar 1
click tm
tell (first menu item whose title contains "Back Up Now") of menu of tm
end tell
end tell

You can probably skip ejecting the Drobo if after the Time Machine process you're shutting down.

You talk about using whatever drive is connected... If it's of use, I have two Time Machine drives, and what I typically do is have them alternate days. That's why the macro I shared is named Time Machine 2, because I also have a macro called Time Machine 1 for another drive. Maybe your setup isn't conducive to something similar, but I thought I'd put that out there.