summaryrefslogtreecommitdiff
path: root/src/op_mode/dynamic_dns.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/op_mode/dynamic_dns.py')
-rwxr-xr-xsrc/op_mode/dynamic_dns.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/op_mode/dynamic_dns.py b/src/op_mode/dynamic_dns.py
index 962943896..263a3b6a5 100755
--- a/src/op_mode/dynamic_dns.py
+++ b/src/op_mode/dynamic_dns.py
@@ -36,6 +36,10 @@ update-status: {{ entry.status }}
"""
def show_status():
+ # A ddclient status file must not always exist
+ if not os.path.exists(cache_file):
+ sys.exit(0)
+
data = {
'hosts': []
}
@@ -61,11 +65,10 @@ def show_status():
if ip:
outp['ip'] = ip.split(',')[0]
- if 'atime=' in line:
- atime = line.split('atime=')[1]
- if atime:
- tmp = atime.split(',')[0]
- outp['time'] = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(int(tmp, base=10)))
+ if 'mtime=' in line:
+ mtime = line.split('mtime=')[1]
+ if mtime:
+ outp['time'] = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(int(mtime.split(',')[0], base=10)))
if 'status=' in line:
status = line.split('status=')[1]