rubysecurity.org

Anecdotes from a Linux Systems Administrator. /root

Home About Books Blog Portfolio Archive
2 December 2011

Monitor your public IP

by Alpha01

My simple yet effective home public IP monitoring script.

#!/bin/bash

current_ip="YOURIPHERE"
ip=`curl -s ifconfig.me`

if [ "$current_ip" != "$ip" ] && [ $ip != "" ]
then
    echo "New IP detected: $ip" | mail -s "Public IP has been changed" [email protected]
fi
Tags: [ bash ]