Skip to content

Instantly share code, notes, and snippets.

@bewebste
Created May 7, 2012 18:47
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bewebste/2629624 to your computer and use it in GitHub Desktop.
Save bewebste/2629624 to your computer and use it in GitHub Desktop.
Script to display Time Machine progress messages as Growl notifications
#!/usr/bin/ruby
#Just run this script in a terminal window, leaving the window open in the
#background so it can continue to process messages.
IO.popen("syslog -F \'$(Sender): $Message\' -w -k Sender com.apple.backupd") { |syslogIO|
while (inputString = syslogIO.gets) do
escapedString = inputString.gsub("'", "\\'")
`/usr/local/bin/growlnotify -a 'Time Machine' -m '#{escapedString}'`
end
}
@cbowns
Copy link

cbowns commented May 15, 2012

Brian, I made a change in https://gist.github.com/2703129 that reformats the messages a bit with -F, give it a whirl.

@bewebste
Copy link
Author

bewebste commented Jun 9, 2012

Thanks Chris, I also just added a line to escape single quotes in the message, which was messing up the shell's parsing of the growlnotify command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment