Fixes for the DDNS setup.
This commit is contained in:
parent
ff070a9465
commit
b119c75c98
2 changed files with 8 additions and 3 deletions
|
@ -10,14 +10,19 @@ if ! DNSRESULT="$(host $DDNSNAME)" ; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
DNSIP4="$(echo \\"$DNSRESULT\\" | grep -m 1 -oE '[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$' || true )"
|
||||
DNSIP6="$(echo \\"$DNSRESULT\\" | grep -m 1 -oE '[0-9a-f]{1,4}:.+:[0-9a-f]{1,4}' || true )"
|
||||
DNSIP4="$(echo "$DNSRESULT" | grep -m 1 -oE '[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$' || true )"
|
||||
DNSIP6="$(echo "$DNSRESULT" | grep -m 1 -oE '[0-9a-f]{1,4}:.+:[0-9a-f]{1,4}' || true )"
|
||||
|
||||
REALIP4="$(wget -q -O - https://ip4.ddnss.de/meineip.php | \
|
||||
grep -m 1 -oE '[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}' || true )"
|
||||
REALIP6="$(wget -q -O - https://ip6.ddnss.de/meineip.php | \
|
||||
grep -m 1 -oE '[0-9a-f]{1,4}:.+:[0-9a-f]{1,4}' || true )"
|
||||
|
||||
if [ -z "$REALIP4" -a -z "$REALIP6" ] ; then
|
||||
echo "Could not detect real IP addresses, exiting."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Current DNS: IPv4=$DNSIP4, IPv6=$DNSIP6."
|
||||
echo "Detected: IPv4=$REALIP4, IPv6=$REALIP6."
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ Description=Update ddns IP-address
|
|||
|
||||
[Timer]
|
||||
OnBootSec=0
|
||||
OnUnitActiveSec=15min
|
||||
OnUnitActiveSec=20min
|
||||
AccuracySec=3min
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue