Android – Checking for Nexus 5 Availability
Saw a great GitHub Gist shared on twitter by @pof for using crontab and curl to check for the Google Play page of the Nexus 5. I added a few tips on getting everything setup for those who might not have postfix running or used crontab recently.
Everything is also on my Gist, which I forked from poliva and added the same tips in a comment: https://gist.github.com/joeykrim/fc0dd9f25dd4cfe55438
Setting up postfix to work with Google Apps: http://blog.bigdinosaur.org/postfix-gmail-and-you/
bash script forked from poliva:
#!/bin/bash URL="https://play.google.com/store/devices/details?id=nexus_5_32gb" EMAIL="[email protected]" mkdir -p /tmp/googleplay/ rm /tmp/googleplay/after 2>/dev/null mv /tmp/googleplay/now /tmp/googleplay/after curl "${URL}" -o /tmp/googleplay/now len=`diff /tmp/googleplay/now /tmp/googleplay/after |wc -l` if [ $len != 0 ]; then echo "${URL}" > /tmp/content.txt cat /tmp/googleplay/now > /tmp/che.html /usr/bin/mutt -x -s "Nexus5 available on GooglePlay" -a \ /tmp/che.html -- ${EMAIL} < /tmp/content.txt fi
Setting the bash script as an executable for crontab: chmod +x nexus5.sh
Good guide on crontab: http://www.thegeekstuff.com/2009/06/15-practical-crontab-examples/
Use the following line for crontab to run the script every 5 minutes:
*/5 * * * * /home/mydirectory/nexus5.sh
Leave a Reply