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:

Setting up postfix to work with Google Apps:

bash script forked from poliva:

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

Setting the bash script as an executable for crontab: chmod +x

Good guide on crontab:
Use the following line for crontab to run the script every 5 minutes:

*/5 * * * * /home/mydirectory/

Leave a Reply

Your email address will not be published. Required fields are marked *