Skip to content

Instantly share code, notes, and snippets.

@Edison-Hsu
Created April 9, 2018 08:17
Show Gist options
  • Save Edison-Hsu/a5664fc5bf4e111db5c7c746e324f304 to your computer and use it in GitHub Desktop.
Save Edison-Hsu/a5664fc5bf4e111db5c7c746e324f304 to your computer and use it in GitHub Desktop.
#! /bin/sh
DOMAIN="us0.0bad.com"
IP=`dig +short $DOMAIN`
OLD_IP=`cat ip.txt`
if [ "$OLD_IP" = "$IP" ]; then
echo "query $DOMAIN address: $IP" >> query_ip.log
else
echo "query $DOMAIN address changed, old: $OLD_IP, new: $IP" >> query_ip.log
echo $IP > ip.txt
sh ip_forward.sh $IP
fi;
echo "$(tail -10 query_ip.log)" > query_ip.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment