Skip to content

Instantly share code, notes, and snippets.

@mxey
Created October 25, 2013 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mxey/7160040 to your computer and use it in GitHub Desktop.
Save mxey/7160040 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>net.mxey.homebrew.upgrade</string>
<key>ProgramArguments</key>
<array>
<string>/Users/mxey/bin/upgrade-homebrew-on-ac</string>
</array>
<key>StartInterval</key>
<integer>46800</integer>
</dict>
</plist>
#!/bin/zsh -e
if system_profiler SPPowerDataType | fgrep -q "Connected: No"; then
echo On battery power, not running
exit 0
fi
terminal-notifier -message "Upgrading your Homebrew packages"
if brew update && brew upgrade && brew cleanup; then
terminal-notifier -message "Homebrew was upgraded"
else
terminal-notifier -message "Homebrew upgrades failed"
fi%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment