Add DDNS service to the Pi
This commit is contained in:
parent
04c8038733
commit
04671f7d31
10 changed files with 96 additions and 12 deletions
10
roles/cloudflare-ddns/files/cloudflare_ddns.timer
Normal file
10
roles/cloudflare-ddns/files/cloudflare_ddns.timer
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=Cloudflare DDNS timer
|
||||
|
||||
[Timer]
|
||||
OnCalendar=daily
|
||||
RandomizedDelaySec=900
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
|
|
@ -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)
|
||||
|
|
@ -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 $@
|
||||
Loading…
Add table
Add a link
Reference in a new issue