Skip to content

Instantly share code, notes, and snippets.

@dewey
Created December 6, 2014 18:24
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 dewey/902a0da58f85feca974a to your computer and use it in GitHub Desktop.
Save dewey/902a0da58f85feca974a to your computer and use it in GitHub Desktop.
Shell script to send push notifications if there are new Gentoo updates available.
#!/bin/zsh
updates=`emerge -pv --color n --update --deep --newuse world`
if [ "`echo $updates | wc -l`" -gt "6" ]; then
message=`echo $updates | grep -F --color=never "ebuild"`
curl -s \
--form-string "token=APP TOKEN HERE" \
--form-string "user=USER TOKEN HERE" \
--form-string "title=Updates available for: `hostname`" \
--form-string "message=$message" \
https://api.pushover.net/1/messages.json
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment