corrent mtime for latest backup
This commit is contained in:
parent
f47f559afb
commit
abd2936da7
16
backup_diff
16
backup_diff
@ -4,6 +4,7 @@ import os
|
|||||||
import re
|
import re
|
||||||
import glob
|
import glob
|
||||||
import difflib
|
import difflib
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
|
||||||
def get_args():
|
def get_args():
|
||||||
@ -45,13 +46,18 @@ def find_backups(backupdir, host):
|
|||||||
try:
|
try:
|
||||||
with open(f'{basepath}.lastchange', 'r') as f:
|
with open(f'{basepath}.lastchange', 'r') as f:
|
||||||
lastchange = f.readlines()[-1].rstrip()
|
lastchange = f.readlines()[-1].rstrip()
|
||||||
backups.insert(0, {
|
|
||||||
'since': lastchange,
|
|
||||||
'until': 'now',
|
|
||||||
'cfn': f'{basepath}.config'
|
|
||||||
})
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
try:
|
||||||
|
info = os.stat(basepath +'.config')
|
||||||
|
mtime = datetime.datetime.fromtimestamp(info.st_mtime).strftime('%F %H:%M:%S (latest)')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
backups.insert(0, {
|
||||||
|
'since': lastchange or '???',
|
||||||
|
'until': mtime or '???',
|
||||||
|
'cfn': f'{basepath}.config'
|
||||||
|
})
|
||||||
return backups
|
return backups
|
||||||
|
|
||||||
def diff(backups, host, n1, n2):
|
def diff(backups, host, n1, n2):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user