Jump to content
ctwise

Time Machine Controller

Recommended Posts

Hmm, it was working fine at first but seems to do nothing since I moved the backup to NAS:

It hangs on checking status and when I choose to start/stop a backup, the notification appears immediately but nothing actually happens. 

 

Edit: Well, I thought it worked once, but the 'tmutil' command seems to be missing in Snow Leopard. Is there an alternative for 'tmutil'?

07.04.13 16:56:35 [0x0-0x2a02a].com.runningwithcrayons.Alfred-2[216] -e:38: command not found: tmutil status
07.04.13 16:56:35 [0x0-0x2a02a].com.runningwithcrayons.Alfred-2[216] -e:22: undefined method `start_with?' for nil:NilClass (NoMethodError)
Edited by derico

Share this post


Link to post

Hi Ted!


 


Thank you very much for the workflow! I tried to cobble something similar together myself - but since I really know nothing about scripting I was glad to find your workflow :)


 


I do have one question though: when I was working on my own workflow for Time Machine I tried to get a notification that shows me the time/date of the last completed backup. I even found a script that will do just that:


 


date -jf "%Y-%m-%d-%H%M%S" "$(tmutil latestbackup | sed 's|.*/||')" +"%F %T"


 


But for it to work the backup drives have to be mounted. Since I use two different drives for Time Machine and one of them is a Time Capsule, that script would always mount the drive first - not a perfect solution... so I kept searching and found this:


 


http://goo.gl/oVCWK


 


But I couldn't make it work. Would it be difficult to add that feature to your workflow? Or maybe you can give me some advice on how I could add it myself, that would be great :) All I really want is a notification with the time/date of the last backup, it doesn't have to be part of the script filter. 


 


Thanks and cheers, Anna

Share this post


Link to post

Hi Ted!

 

Thank you very much for the workflow! I tried to cobble something similar together myself - but since I really know nothing about scripting I was glad to find your workflow :)

 

I do have one question though: when I was working on my own workflow for Time Machine I tried to get a notification that shows me the time/date of the last completed backup. I even found a script that will do just that:

 

date -jf "%Y-%m-%d-%H%M%S" "$(tmutil latestbackup | sed 's|.*/||')" +"%F %T"

 

But for it to work the backup drives have to be mounted. Since I use two different drives for Time Machine and one of them is a Time Capsule, that script would always mount the drive first - not a perfect solution... so I kept searching and found this:

 

http://goo.gl/oVCWK

 

But I couldn't make it work. Would it be difficult to add that feature to your workflow? Or maybe you can give me some advice on how I could add it myself, that would be great :) All I really want is a notification with the time/date of the last backup, it doesn't have to be part of the script filter. 

 

Thanks and cheers, Anna

 

You can build a quick workflow yourself. Create the workflow, trigger it with a keyword of your choice, connect it to a Ruby script and paste this in the box:

 

require 'date'
puts DateTime.strptime((`defaults read /private/var/db/.TimeMachine.Results BACKUP_COMPLETED_DATE`.strip), "%Y-%m-%d %H:%M:%S %z").new_offset(DateTime.now.offset).strftime("%A %B %d, %Y %l:%M %P")

 

And connect the script to a display large type output.

Edited by ctwise

Share this post


Link to post

Hi Ted, thank you so much for your fast response, I really appreciate it!


 


I feel like an idiot, but I don't get any output from the Ruby script...


I have connected the keyword trigger to a "run script" module (/usr/bin/ruby) and added a "large type" module at the end - but nothing happens when I type the keyword. I don't get an error in Console app either.


 


I have never had anything to do with Ruby, but Terminal tells me I have version 1.8.7 (thanks, Google!) and I'm on a recent Mac with 10.8.3. - is there anything else I need to install?


 


Thanks again for your help :)

Share this post


Link to post

Hi Ted, thank you so much for your fast response, I really appreciate it!

 

I feel like an idiot, but I don't get any output from the Ruby script...

I have connected the keyword trigger to a "run script" module (/usr/bin/ruby) and added a "large type" module at the end - but nothing happens when I type the keyword. I don't get an error in Console app either.

 

I have never had anything to do with Ruby, but Terminal tells me I have version 1.8.7 (thanks, Google!) and I'm on a recent Mac with 10.8.3. - is there anything else I need to install?

 

Thanks again for your help :)

 

I edited my reply since I forgot the require statement. Try the updated code.

Share this post


Link to post

Hi,

 

Nice workflow.

 

I'm new to all of this...is there a way to get the Time Machine controller to work in the Alfred remote?

 

Thanks,

neilf

Share this post


Link to post

Hi,

 

Nice workflow.

 

I'm new to all of this...is there a way to get the Time Machine controller to work in the Alfred remote?

 

Thanks,

neilf

 

I just updated the workflow on Packal to add remote triggers.

Share this post


Link to post

I tried this out on Mojave, and the status fails over to a google search. With some investigation, I found that the method for getting the latest backups is obsolete.  Digging around online, I found a way to query backup information even when the backup discs are unavailable:

 

/usr/libexec/PlistBuddy -c "Print Destinations" /Library/Preferences/com.apple.TimeMachine.plist

 

This gives you every TM volume's list of backups, which should be parseable to make it pretty, and to possibly only grab the BackupAlias and last "SnapshotArray" date. I haven't had time to modify your script to make that work, but thought I'd share what I found in case you're still updating the workflow.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...