Skip to content

Instantly share code, notes, and snippets.

@freejoe76
Last active September 30, 2015 03:38
Show Gist options
  • Save freejoe76/1715495 to your computer and use it in GitHub Desktop.
Save freejoe76/1715495 to your computer and use it in GitHub Desktop.
Email one or many people when a twitter account hasn't been updated in the last hour.
#!/bin/sh
#
# NOTE: Twitter updated their m.twitter site January 2013, and this script doesn't work anymore.
#
# This script is useful for alerting a team of people when a twitter account
# hasn't been updated in the past hour. There may be other uses as well.
#
# $1 = what account to check
# $2 = what string to look for. To test the script, use 'test'
#
# FILE: emails
# Email addresses (each on its own line) in a file 'emails' will be alerted
# if the string we're looking for isn't on the page.
#
# FILE: note
# The message emailed is contained in a file 'note'
#
# To see a typical page it's scraping, go to https://mobile.twitter.com/denverpost
#
# Example: ./tweetcheck.sh denverpost m
DEV_EMAIL='your.email@gmail.com'
if wget https://mobile.twitter.com/$1 -qO- | grep -E \>[0-9]+$2
then
exit 2
else
if [ $2 = 'test' ]
then
mail -s "ALERT: No Recent tweets from $1" $DEV_EMAIL < note
else
for e in `cat emails`; do mail -s "ALERT: No Recent tweets from $1" $e < note; done
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment