UnixServerAdmin

Server Administration & Management

whatismyip.sh

###########################################################
## whatismyip.sh ##
###########################################################
#! /bin/bash

/bin/echo “—————————————” >> /REPORTS/liveip.log_$(date +%d%m%y)
/bin/echo “External IP: –> `wget http://www.whatismyip.org -O – -o /dev/null` ” >> /REPORTS/liveip.log_$(date +%d%m%y)
/bin/echo >> /REPORTS/liveip.log_$(date +%d%m%y)
/bin/echo “External IP: Verify –> `wget -q -O – checkip.dyndns.org|sed -e ‘s/.*Current IP Address: //’ -e ‘s/<.*$//’ `” >> /REPORTS/liveip.log_$(date +%d%m%y)
/bin/echo >> /REPORTS/liveip.log_$(date +%d%m%y)
/bin/echo “Internal IP: –> `ifconfig | grep ‘inet addr:’| grep -v ‘127.0.0.1’ | cut -d: -f2 | awk ‘{ print $1}’`” >> /REPORTS/liveip.log_$(date +%d%m%y)
/bin/echo “—————————————-” >> /REPORTS/liveip.log_$(date +%d%m%y)
/bin/echo >> /REPORTS/liveip.log_$(date +%d%m%y)

mutt -s “External Live IP $(hostname | tr ‘a-z’ ‘A-Z’)” -a /REPORTS/liveip.log_$(date +%d%m%y) unixserv@unixserveradmin.com

December 7, 2011 Posted by | Shell Script, Tips & Tricks | , | Leave a comment