Use Gandi LiveDNS API to update DNS records with a dynamic IP.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.md
config.ini-dist
dyn_gandi.py
ip_resolver.py
livedns_client.py
requirements.txt
setup.py

README.md

dyn-gandi

Use Gandi LiveDNS API to update DNS records with a dynamic IP.

Prequisites

Installation

Installation from release :
  • Download and extract the latest release.
  • Open a terminal to the extracted directory.
Installation from sources :
$ curl --location https://github.com/Danamir/dyn-gandi/archive/master.zip --output dyn-gandi-master.zip
$ unzip dyn-gandi-master.zip
$ mv dyn-gandi-master/ dyn-gandi
$ cd dyn-gandi
Setup :

(Optional) Configure Python virtual environment :

$ python -m venv .env
$ . .env/bin/activate (Linux) 
-or-
$ .env/Script/activate.bat (Windows)

Install :

$ python setup.py develop
$ copy config.ini-dist config.ini
$ dyn_gandi --help
-or-
$ python dyn_gandi.py --help

Complete the config.ini file, in particular check the lines :

[api]
key =

[dns]
domain = 
records = @,www

Running

Note: dyn_gandi can be substituted with python dyn_gandi.py if the former does'nt work.

Display help :

$ dyn_gandi --help

Dry run (without modifications) :

$ dyn_gandi --dry-run

Normal launch:

$ dyn_gandi

The log line will end by [OK] if no update was needed, [UPDATE] on successful update, and [ERROR] on error. On success, the automatic backup snapshot is deleted ; on error the snapshot uuid is displayed in the log for you to restore if needed.

Cron

Either create a scheduled task on windows, or add a crontab line. ie:

$ crontab -e
* */2 * * * dyn_gandi --log /var/log/dyn-gandi.log

NB: If you used a Python virtual environment, replace the script by <dyn-gandi-path>/.env/bin/dyn_gandi .

Notes