fix & cleanup

This commit is contained in:
pj 2021-02-27 13:11:26 +01:00
parent f381cc46d8
commit b012a6b7dd

View file

@ -50,7 +50,7 @@ checkDNS_interval_hrs = 12.1 # when the saved IP addresses are old, check the DN
current_ip_file = "/tmp/current_ip.json"
def send_email(msg, sender = 'no_reply@mydomain.com', receiver = 'admin@mydomain.com')
def send_email(msg, sender = 'no_reply@mydomain.com', receiver = 'admin@mydomain.com') :
import smtplib
try :
@ -186,7 +186,7 @@ if current_ipv4 or current_ipv6 : #we could get at least one address
#print("Not touching AAAA record for {}.{}, as instructed".format(subdomain, domain))
pass
#all hosts records have been updated without errors, log change and save current addresses
print("{} : new addresses {} ; {} -- {} records updates".format(timestamp(), current_ipv4, current_ipv6, records_changed)
print("{} : new addresses {} ; {} -- {} records updates".format(timestamp(), current_ipv4, current_ipv6, records_changed))
with open(current_ip_file, 'w') as f:
json.dump([time.time(), current_ipv4, current_ipv6],f)
except Exception as e: #some error occured (API down, keys expired...?),