6

I need the reference, if it exists, to Time Machine's API or simply some commands that can change the disk in use with Time Machine and back!

I'd like the script I'm going to write to do the following:

Change from disk A to disk B
Force Time Machine backup
Change from disk B back to disk A

Thank you!

Olivier Tremblay
  • 1,441
  • 2
  • 20
  • 37

5 Answers5

9

Lion added tmutil, a command line interface into Time Machine.

https://apple.stackexchange.com/questions/17759/what-tiny-thing-in-lion-makes-you-smile-or-has-caught-you-off-guard/18665#18665

Community
  • 1
  • 1
Yannick
  • 535
  • 4
  • 18
1

If AppleScript is fine with you have a look at this post with script. It should serve as a basis for your own.

extraneon
  • 23,575
  • 2
  • 47
  • 51
  • The solution doesn't appeal to me much, as I'm pretty sure it shouldn't be as complex as that just to swap a drive... I mean, right, it does work, and I could resort to that if I find absolutely nothing else... – Olivier Tremblay Jan 11 '10 at 13:33
  • Much of the complexity in that script is just checking whether the drive is available and doing the Growl notification. The actual logic to change drives isn’t too bad, and involves UI-scripting the Time Machine Preferences panel. While this is not an API, it is certainly the safe way to do it. – Nate Jan 11 '10 at 14:45
1

Apple time capsules include an 'archive' command that can back-up the time capsule disk to an external USB-attached disk.

Alex Brown
  • 41,819
  • 10
  • 94
  • 108
  • Not sure, but since an archive takes several hours I don't think you would benefit much from having a command-line form. But I like your thinking. – Alex Brown Jan 07 '14 at 19:22
0

This Krypted.com blog post has a good list of the main command line use cases.

Also, if you are interested in anything Time Machine the place to start is the unofficial pondini FAQ.

studgeek
  • 14,272
  • 6
  • 84
  • 96
0

If I knew what to put there, it seems the file to edit is /Library/Preferences/com.apple.TimeMachine.plist.

You can achieve the correct configuration using "defaults write" to overwrite the relevant settings, although it seems like you have to modify the BackupAlias, which seems to be a hexdump of something I couldn't quite decipher. It does contain the path to my TimeMachine disk, though.

The sanest solution would be to copy the original settings, and then swap files whenever needed.

Olivier Tremblay
  • 1,441
  • 2
  • 20
  • 37