Skip to content

Instantly share code, notes, and snippets.

@peta
Last active December 10, 2015 14:38
Show Gist options
  • Select an option

  • Save peta/4448407 to your computer and use it in GitHub Desktop.

Select an option

Save peta/4448407 to your computer and use it in GitHub Desktop.
Cronjob der alle 30 Minuten die Verfügbarkeit der Google Nexus 10 Tablets im Google-Play-Store prüft und – wenn lieferbar – eine Benachrichtigungs-Mail an eine gegebene Adresse verschickt. `crontab isnexusinstock.cron`
*/30 * * * * /path/to/your/isnexusinstock.sh
#!/usr/bin/env sh
send_to='[email protected]'
oos_str='<div class="hardware-small-print">Momentan nicht auf Lager. Bitte besuchen Sie uns bald wieder.</div>'
check_avail() {
curl -s "$2" | grep -F "$oos_str" >> /dev/null || {
echo "Hier gehts zur Bestellseite: $2" | mail -s "Wieder lieferbar: $1" "$send_to"
return 0
}
return 1
}
# Do the work
check_avail 'Nexus 10 16GB' 'https://play.google.com/store/devices/details/Nexus_10_16GB?id=nexus_10_16gb'
check_avail 'Nexus 10 32GB' 'https://play.google.com/store/devices/details?id=nexus_10_32gb'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment