Skip to content

Instantly share code, notes, and snippets.

@AlexKMDev
Last active August 29, 2015 14:04
Show Gist options
  • Save AlexKMDev/30b26d6fc7ca3e76825a to your computer and use it in GitHub Desktop.
Save AlexKMDev/30b26d6fc7ca3e76825a to your computer and use it in GitHub Desktop.
homebrew outdated packages notification
# put this to crontab
@daily ~/notify.sh
# for automatic updates (not upgrades)
@daily /usr/local/bin/brew update > /dev/null 2>&1
#!/bin/sh
OSASCRIPT_PATH=$(which osascript)
BREW_PATH=/usr/local/bin/brew
OUTDATED_PKGS=$($BREW_PATH outdated --verbose)
if [ -z "$OSASCRIPT_PATH" ]; then
echo "Osascript isn't installed!"
exit 1
fi
if [ -z "$BREW_PATH" ]; then
echo "Homebrew isn't installed!"
exit 1
fi
if ! [ -z "$OUTDATED_PKGS" ]; then
$OSASCRIPT_PATH -e "display notification \"$OUTDATED_PKGS\" with title \"Outdated packages\" sound name \"Glass\""
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment