Skip to content

Instantly share code, notes, and snippets.

@avances123
Forked from arturoherrero/nexus-availability.sh
Last active December 12, 2015 03:58
Show Gist options
  • Save avances123/4710991 to your computer and use it in GitHub Desktop.
Save avances123/4710991 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Check the availability of Nexus X devices.
#
# Install wget from Homebrew:
# $ brew install wget
#
# Setup OS X Mountain Lion to send mails from Terminal:
# $ sudo mkdir -p /Library/Server/Mail/Data/spool
# $ sudo /usr/sbin/postfix start
#
# Edit crontab to run this script every 30 minutes:
# $ crontab -e
# 0,30 * * * * /path/to/script/nexus-availability.sh
#
# Create a filter in gmail for your local email account:
# 'Never send it to Spam'
nexus4=https://play.google.com/store/devices/details?id=nexus_4_16gb
nexus7=https://play.google.com/store/devices/details?id=nexus_7_32gb
model=$nexus4
outOfStock=$(wget -qO- $model | grep -Eio 'AGOTADO|SIN STOCK')
if [ "$outOfStock" == "" ]; then
echo "Hay stock de Nexus, entra a comprarlo ya: $model" |
mail -s "Hay stock de Nexus" avances123@gmail.com
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment