Created
December 6, 2014 18:24
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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