Skip to content

Instantly share code, notes, and snippets.

@atais
Last active March 25, 2020 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atais/e5477e46048f83680e71baa6e44b80f1 to your computer and use it in GitHub Desktop.
Save atais/e5477e46048f83680e71baa6e44b80f1 to your computer and use it in GitHub Desktop.
Check if ip is up to date
#/bin/sh
CIP=$(curl http://192.168.0.1/sysbus/NMC:getWANStatus -XPOST | jq .data.IPAddress -r)
DIP=$(ping -c 1 -w 1 domain.pl | awk -F'[()]' '/PING/{print $2}')
if [ "$CIP" != "$DIP" ] ; then
echo "[$(date)] $CIP != $DIP"
/share/CE_CACHEDEV1_DATA/Web/ddns/ddns-update $CIP
else
echo "[$(date)] $CIP == $DIP"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment