Add DDNS service to the Pi

This commit is contained in:
Thomas Kleinendorst 2024-04-12 08:39:41 +02:00
parent 04c8038733
commit 04671f7d31
10 changed files with 96 additions and 12 deletions

View file

@ -0,0 +1,10 @@
[Unit]
Description=Cloudflare DDNS timer
[Timer]
OnCalendar=daily
RandomizedDelaySec=900
Persistent=true
[Install]
WantedBy=timers.target

View file

@ -40,8 +40,8 @@ for subdomain in subdomains:
resolvedIP = resolve_name(fullDomainName)
if resolvedIP == publicIP:
logging.info(f'Currently resolved name already matches the public ip ({publicIP}), exiting...')
exit(0)
logging.info(f'Currently resolved name already matches the public ip ({publicIP}), skipping this name...')
continue
zoneId = cloudflare.get_zone_id(fixedTopLevelDomain)
recordId = cloudflare.get_record_id(zoneId, fullDomainName)

View file

@ -0,0 +1,3 @@
#!/usr/bin/bash
source ~/bin/cloudflare_ddns/venv/bin/activate
python3 ~/bin/cloudflare_ddns/cloudflare_ddns.py --config-file ~/cloudflare_ddns/ddns_config.ini $@