bundles/pppd: add systemd-timer to automatically update dyndns
This commit is contained in:
parent
573287e6f1
commit
5261375574
4 changed files with 75 additions and 10 deletions
17
bundles/pppd/files/dyndns_periodic
Normal file
17
bundles/pppd/files/dyndns_periodic
Normal 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
|
5
bundles/pppd/files/dyndns_periodic.service
Normal file
5
bundles/pppd/files/dyndns_periodic.service
Normal file
|
@ -0,0 +1,5 @@
|
|||
[Unit]
|
||||
Description=dyndns periodic checker and updater
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/dyndns_periodic
|
8
bundles/pppd/files/dyndns_periodic.timer
Normal file
8
bundles/pppd/files/dyndns_periodic.timer
Normal file
|
@ -0,0 +1,8 @@
|
|||
[Unit]
|
||||
Description=run dyndns periodic checker and updater
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*:0/5
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
Loading…
Add table
Add a link
Reference in a new issue