bundles/pppd: add systemd-timer to automatically update dyndns

This commit is contained in:
Franzi 2021-12-19 06:21:04 +01:00
parent 573287e6f1
commit 5261375574
Signed by: kunsi
GPG key ID: 12E3D2136B818350
4 changed files with 75 additions and 10 deletions

View file

@ -0,0 +1,17 @@
#!/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

View file

@ -0,0 +1,5 @@
[Unit]
Description=dyndns periodic checker and updater
[Service]
ExecStart=/usr/local/bin/dyndns_periodic

View file

@ -0,0 +1,8 @@
[Unit]
Description=run dyndns periodic checker and updater
[Timer]
OnCalendar=*:0/5
[Install]
WantedBy=timers.target