prune database backups even if there's more than 5
This commit is contained in:
parent
920456ea17
commit
fe16c0132f
1 changed files with 3 additions and 2 deletions
|
@ -18,8 +18,9 @@ class Module(ModuleManager.BaseModule):
|
||||||
files = glob.glob("%s.*" % location)
|
files = glob.glob("%s.*" % location)
|
||||||
files = sorted(files)
|
files = sorted(files)
|
||||||
|
|
||||||
if len(files) == 5:
|
while len(files) > 4:
|
||||||
os.remove(files[0])
|
os.remove(files[-1])
|
||||||
|
files.pop(-1)
|
||||||
|
|
||||||
suffix = datetime.datetime.now().strftime("%y-%m-%d.%H:%M:%S")
|
suffix = datetime.datetime.now().strftime("%y-%m-%d.%H:%M:%S")
|
||||||
backup_file = "%s.%s" % (location, suffix)
|
backup_file = "%s.%s" % (location, suffix)
|
||||||
|
|
Loading…
Reference in a new issue