commit d5b65c7773f319fb40e2479916f59df29293e866 parent 1f3ee79bf1b72233cf3bee880fc3b35de0a3cd4e Author: pyratebeard <root@pyratebeard.net> Date: Fri, 13 Mar 2020 11:47:20 +0000 check external ip Diffstat:
A | bin/bin/checkip | | | 13 | +++++++++++++ |
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/bin/bin/checkip b/bin/bin/checkip @@ -0,0 +1,13 @@ +#!/usr/bin/zsh + +ipCmd=$(dig +short myip.opendns.com @resolver1.opendns.com) +ipFile="/tmp/current_ip" + +if [ ! -f $ipFile ] ; then + echo "$ipCmd" > $ipFile +fi + +if [[ $ipCmd != $(cat $ipFile) ]] ; then + echo "vpn ip has changed to $ipCmd" | mutt -s "vpn ip" root@pyratebeard.net + echo "$ipCmd" > $ipFile +fi