05/01/11 20:00:06

Time Machine Growl Notifications

This belongs to “Project getting rid of menubar buttons”.

The only reasons to have Time Machines’ shown in the menubar are:

  1. Entering Time Machine to restore files.
  2. Being informed about Time Machine status, e.g. currently backing up.

Entering Time Machine

The first one can be rid immediately. To enter Time Machine simply launch Time Machine via Spotlight, Dock or an application launcher like Alfred or LaunchBar.

Current Time Machine Status

This is a bit trickier as there is no API or anything developers or AppleScripters could use to get this sort of information directly.
There is however a workaround which uses a rather smart technique reading from system log. Peter Hosey (@boredzo. Follow!) even came up with a very elegant solution in Objective-C to send Growl notifications. Pick the one that fits best your configuration and needs.

This Mac OS X Hint recommends a one-line shell script to get the last couple of messages using syslog. This is handy for GeekTool and direct output on the desktop.

syslog -F '$Time $Message' -k Sender com.apple.backupd -k Time ge -72h


This is a slightly modified to the one mentioned on OS X Hints. The one there outputs all messages from the last 72 hours. A bit too much for my taste. Replace “1h” at the end with “5m” to get all messages from the last 5 minutes. You get the idea.
Too only get the very last log entry add | tail -n 1

syslog -F '$Time $Message' -k Sender com.apple.backupd -k Time ge -72h | tail -n 1


Growl

Peters TimeMachineGrowler is a faceless background application. (Once started there is no menu or anything. To quit use Activity Monitor.)
The app does basically the same as the aforementioned script, but much more elegantly using native C calls, which makes calls more performant.