bundlewrap/bundles/pppd/files/dyndns_periodic

18 lines
502 B
Text
Raw Normal View History

#!/bin/bash
[[ -n "$DEBUG" ]] && set -x
interface="$(ip link show | awk '/ ppp/ {print substr($2, 1, length($2)-1)}')"
addr="$(ip addr show dev "$interface" | awk '/inet / {print $2}')"
resolved="$(dig +short "${domain}" A)"
if [[ -z "$addr" ]] || [[ -z "$resolved" ]]
then
echo "Something is wrong:"
echo "Address on '$interface' is '$addr'"
echo "Resolved DNS is '$resolved'"
elif [[ "$addr" != "$resolved" ]]
then
/etc/ppp/ip-up.d/dyndns "$interface" "doesnt" "matter" "$addr"
fi