dotfiles

*nix config files
git clone git://git.pyratebeard.net/dotfiles.git
Log | Files | Refs | README

checkip (353B)


      1 #!/usr/bin/zsh
      2 
      3 ipCmd=$(dig +short myip.opendns.com @resolver1.opendns.com)
      4 ipFile="$HOME/tmp/current_ip"
      5 pager="https://pager.pyratebeard.net/vpn"
      6 
      7 if [ ! -f $ipFile ] ; then
      8 	echo "$ipCmd" > $ipFile
      9 fi
     10 
     11 if [[ $ipCmd != $(cat $ipFile) ]] && [[ $ipCmd != "" ]] ; then
     12 	curl -d "ip changed to ${ipCmd}" ${pager}
     13 	echo "$ipCmd" > $ipFile
     14 fi
     15 echo "$ipCmd"