Skip to content

Instantly share code, notes, and snippets.

@atais
Last active March 25, 2020 09:50
Show Gist options
  • Save atais/4c2d1b60e4abe997f8c231554d52782d to your computer and use it in GitHub Desktop.
Save atais/4c2d1b60e4abe997f8c231554d52782d to your computer and use it in GitHub Desktop.
update ddns on OVH
#!/bin/sh
###
# Based on
# https://github.com/RMerl/asuswrt-merlin/wiki/Custom-DDNS#google-domains
# https://github.com/RMerl/asuswrt-merlin/wiki/Custom-DDNS#bind9-ddns-using-nsupdate
###
set -u
U=USER
P=****
IP=$1
# args: username password hostname ip
ovh_dns_update() {
CMD=$(curl -s -u "$U":"$P" "https://www.ovh.com/nic/update?system=dyndns&hostname=$1&myip=$IP")
case "$CMD" in
good*|nochg*) echo "Updated $1 to $IP" ;;
*) echo "During updating $1 to $IP, error: $CMD" ;;
esac
}
ovh_dns_update domain.pl
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment