Skip to content

Instantly share code, notes, and snippets.

@Avasz
Created December 22, 2013 16:25
Show Gist options
  • Select an option

  • Save Avasz/8084916 to your computer and use it in GitHub Desktop.

Select an option

Save Avasz/8084916 to your computer and use it in GitHub Desktop.
#!/bin/bash
x=192.168.1.1
while :
do
y=$(curl icanhazip.com)
if [ $x != $y ]
then
rm -rf /tmp/ipaddr
touch /tmp/ipaddr
echo "Current IP: $y" > /tmp/ipaddr
mailx -s "IPADDRESS" [email protected] < /tmp/ipaddr
x=$y
fi
sleep 1800
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment