Skip to content

Instantly share code, notes, and snippets.

@zachlatta
Last active December 27, 2015 05:49
Show Gist options
  • Save zachlatta/7277571 to your computer and use it in GitHub Desktop.
Save zachlatta/7277571 to your computer and use it in GitHub Desktop.
#!/bin/bash
file="/usr/local/bin/nexus5ship"
tmp="/tmp/nexus5ship"
curl -s https://gist.github.com/zachlatta/7277571/raw/e3e65590383d42c4bce2eaec7c9cef75fa7e751e/nexus5ship.sh > $tmp
sudo mv $tmp $file
sudo chmod +x $file
read -p "Tracking code: " tracking_code
sudo sed -i s/TRACKING_NUMBER/$tracking_code/g $file
read -p "Email: " email
sudo sed -i s/YOUR_EMAIL/$email/g $file
cron_entry="* * * * * $file"
(crontab -l; echo "$cron_entry") | crontab -
#!/bin/sh
url="http://wwwapps.ups.com/ietracking/tracking.cgi?loc=US_US&tracknum=TRACKING_NUMBER"
new=`curl $url`
old=`cat /tmp/shipping.html`
if [ "$new" != "$old" ]; then
echo "There has been a shipping update! $url" | mail -s "Nexus 5 Delivery Update" YOUR_EMAIL
echo "$new" > /tmp/shipping.html
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment