20 lines
619 B
Bash
Executable File
20 lines
619 B
Bash
Executable File
#!/bin/sh
|
|
|
|
if test "x$DYN_SERVER" = x; then echo export DYN_SERVER=ns.example.com; exit=1; fi
|
|
if test "x$DYN_DOMAIN" = x; then echo export DYN_DOMAIN=example.com; exit=1; fi
|
|
if test "x$DYN_SCRIPT" = x; then echo export DYN_SCRIPT=/path/to/script; exit=1; fi
|
|
if test "x$exit" = x1; then exit 1; fi
|
|
|
|
if test "x$DYN_IPAPI" = x; then DYN_IPAPI=ifconfig.co; fi
|
|
|
|
IPACTUAL=$(wget -qO - "$DYN_IPAPI")
|
|
IPSERVER=$(dig +short $DYN_DOMAIN @$DYN_SERVER)
|
|
|
|
if test "x$IPSERVER" = x -o "x$IPACTUAL" = x; then
|
|
: # ERROR: IP unknown
|
|
elif test "x$IPSERVER" = "x$IPACTUAL"; then
|
|
: # INFO: IP not changed
|
|
else
|
|
"$DYN_SCRIPT" $IPACTUAL
|
|
fi
|