Skip to content

Instantly share code, notes, and snippets.

@mxswd
Created July 9, 2011 05:12
Show Gist options
  • Save mxswd/1073343 to your computer and use it in GitHub Desktop.
Save mxswd/1073343 to your computer and use it in GitHub Desktop.
Mac OS X Checking if Backups work
#!/usr/bin/ruby
# remember to:
# sudo gem install pony
require 'rubygems'
require 'pony'
# -k Sender com.apple.backupd-auto
# This option specifies what recorded the log.
# -k Time ge -48h
# This filters out anything before 48 hours ago.
result = `syslog -k Sender com.apple.backupd-auto -k Time ge -48h`
if result.length > 1
Pony.mail(:to => "EMAIL_TO_SEND_TO",
:via => :smtp,
:via_options=> {
:address => 'smtp.gmail.com',
:port => '587',
:enable_starttls_auto => true,
:user_name => "EMAIL_TO_SEND_FROM",
:password => "EMAIL_PASSWORD",
:authentication => :plain,
:domain => 'gmail.com'
},
:subject => 'Backup Failure',
:body => result)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment