[OVH] DynDNS sur script Linux

Création du script

#!/bin/sh

DYNHOST_ID=''
DYNHOST_PASSWORD=''
DOMAIN_NAME=''

PUBLIC_IP=$(host myip.opendns.com resolver1.opendns.com | grep "myip.opendns.com has" | awk '{print $4}')
#Call OVH for update
curl --silent --user "$DYNHOST_ID:$DYNHOST_PASSWORD" "https://www.ovh.com/nic/update?system=dyndns&hostname=$DOMAIN_NAME&myip=$PUBLIC_IP"

Attribution des droits sur le script

sudo chmod 700 /usr/local/sbin/dyndns.sh 

Exécution du script manuellement 

sudo /usr/local/sbin/dyndns.sh

Automatiser l'exécution du script

sudo crontab -e 

A la fin du fichier ajouter la ligne suivante :

« */5 * * * * /usr/local/sbin/dyndns.sh > /dev/null 2>&1 »

L'exécution du script est définie toutes les 5 minutes


Revision #7
Created 2025-10-29 15:28:05 UTC by Corentin Roche
Updated 2026-04-29 10:47:41 UTC by Corentin Roche