Synced repeat interval with TTL
This commit is contained in:
parent
cb539ad64d
commit
ae7be14004
@ -233,27 +233,28 @@ if __name__ == '__main__':
|
|||||||
try:
|
try:
|
||||||
ttl = int(config["ttl"])
|
ttl = int(config["ttl"])
|
||||||
except:
|
except:
|
||||||
ttl = 300
|
ttl = 300 # default Cloudflare TTL
|
||||||
print(
|
print(
|
||||||
"⚙️ No config detected for 'ttl' - defaulting to 300 seconds (5 minutes)")
|
"⚙️ No config detected for 'ttl' - defaulting to 300 seconds (5 minutes)")
|
||||||
if ttl < 30:
|
if ttl < 30:
|
||||||
ttl = 30 # default Cloudflare TTL
|
ttl = 30 #
|
||||||
print("⚙️ TTL is too low - defaulting to 60 seconds (1 minute)")
|
print("⚙️ TTL is too low - defaulting to 30 seconds")
|
||||||
if(len(sys.argv) > 1):
|
if(len(sys.argv) > 1):
|
||||||
if(sys.argv[1] == "--repeat"):
|
if(sys.argv[1] == "--repeat"):
|
||||||
delay = 5*60
|
|
||||||
if ipv4_enabled and ipv6_enabled:
|
if ipv4_enabled and ipv6_enabled:
|
||||||
print("🕰️ Updating IPv4 (A) & IPv6 (AAAA) records every 5 minutes")
|
print(
|
||||||
|
"🕰️ Updating IPv4 (A) & IPv6 (AAAA) records every " + ttl + " seconds")
|
||||||
elif ipv4_enabled and not ipv6_enabled:
|
elif ipv4_enabled and not ipv6_enabled:
|
||||||
print("🕰️ Updating IPv4 (A) records every 5 minutes")
|
print("🕰️ Updating IPv4 (A) records every " + ttl + " seconds")
|
||||||
elif ipv6_enabled and not ipv4_enabled:
|
elif ipv6_enabled and not ipv4_enabled:
|
||||||
print("🕰️ Updating IPv6 (AAAA) records every 5 minutes")
|
print("🕰️ Updating IPv6 (AAAA) records every " +
|
||||||
|
ttl + " seconds")
|
||||||
next_time = time.time()
|
next_time = time.time()
|
||||||
killer = GracefulExit()
|
killer = GracefulExit()
|
||||||
prev_ips = None
|
prev_ips = None
|
||||||
while True:
|
while True:
|
||||||
updateIPs(getIPs())
|
updateIPs(getIPs())
|
||||||
if killer.kill_now.wait(delay):
|
if killer.kill_now.wait(ttl):
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
print("❓ Unrecognized parameter '" +
|
print("❓ Unrecognized parameter '" +
|
||||||
|
|||||||
Reference in New Issue
Block a user