Skip to content

Instantly share code, notes, and snippets.

@atais
Last active March 25, 2020 09:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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