Skip to content

Instantly share code, notes, and snippets.

@Elbandi
Created March 7, 2013 22:37
Show Gist options
  • Save Elbandi/5112486 to your computer and use it in GitHub Desktop.
Save Elbandi/5112486 to your computer and use it in GitHub Desktop.
KEY=/etc/bind/Kize.domain.hu.+111+11111
SERVER=1.2.3.4
ZONE=domain.hu
HOSTNAME=ize
ddns_setup_set() {
if [ "$interface" != "eth0" ] && [ "$new_ip_address" = "$old_ip_address" ]; then
return
fi
(
sleep 5
cat <<EOF | nsupdate -d -k "$KEY" 2>/dev/null
server $SERVER
zone $ZONE
update delete $HOSTNAME.$ZONE
update add $HOSTNAME.$ZONE 60 A $new_ip_address
send
EOF
) &
}
ddns_setup() {
case $reason in
BOUND|RENEW|REBIND|REBOOT)
ddns_setup_set
;;
*)
;;
esac
}
ddns_setup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment