mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-11-22 02:17:26 +00:00
backups: predict when the next backup will occur
This commit is contained in:
parent
b539c2df70
commit
c18d58b13f
@ -15,6 +15,7 @@ System:
|
|||||||
Control panel:
|
Control panel:
|
||||||
|
|
||||||
* The new check that system services are running mistakenly checked that the Dovecot Managesieve service is publicly accessible. Although the service binds to the public network interface we don't open the port in ufw. On some machines it seems that ufw blocks the connection from the status checks (which seems correct) and on some machines (mine) it doesn't, which is why I didn't notice the problem.
|
* The new check that system services are running mistakenly checked that the Dovecot Managesieve service is publicly accessible. Although the service binds to the public network interface we don't open the port in ufw. On some machines it seems that ufw blocks the connection from the status checks (which seems correct) and on some machines (mine) it doesn't, which is why I didn't notice the problem.
|
||||||
|
* The current backup chain will now try to predict how many days until it is deleted (always at least 3 days after the next full backup).
|
||||||
|
|
||||||
v0.07 (February 28, 2015)
|
v0.07 (February 28, 2015)
|
||||||
-------------------------
|
-------------------------
|
||||||
|
@ -67,9 +67,29 @@ def backup_status(env):
|
|||||||
# This is relied on by should_force_full() and the next step.
|
# This is relied on by should_force_full() and the next step.
|
||||||
backups = sorted(backups.values(), key = lambda b : b["date"], reverse=True)
|
backups = sorted(backups.values(), key = lambda b : b["date"], reverse=True)
|
||||||
|
|
||||||
|
# Get the average size of incremental backups and the size of the
|
||||||
|
# most recent full backup.
|
||||||
|
incremental_count = 0
|
||||||
|
incremental_size = 0
|
||||||
|
first_full_size = None
|
||||||
|
for bak in backups:
|
||||||
|
if bak["full"]:
|
||||||
|
first_full_size = bak["size"]
|
||||||
|
break
|
||||||
|
incremental_count += 1
|
||||||
|
incremental_size += bak["size"]
|
||||||
|
|
||||||
|
# Predict how many more increments until the next full backup,
|
||||||
|
# and add to that the time we hold onto backups, to predict
|
||||||
|
# how long the most recent full backup+increments will be held
|
||||||
|
# onto. Round up since the backup occurs on the night following
|
||||||
|
# when the threshold is met.
|
||||||
|
deleted_in = None
|
||||||
|
if incremental_count > 0 and first_full_size is not None:
|
||||||
|
deleted_in = "approx. %d days" % round(keep_backups_for_days + (.5 * first_full_size - incremental_size) / (incremental_size/incremental_count) + .5)
|
||||||
|
|
||||||
# When will a backup be deleted?
|
# When will a backup be deleted?
|
||||||
saw_full = False
|
saw_full = False
|
||||||
deleted_in = None
|
|
||||||
days_ago = now - datetime.timedelta(days=keep_backups_for_days)
|
days_ago = now - datetime.timedelta(days=keep_backups_for_days)
|
||||||
for bak in backups:
|
for bak in backups:
|
||||||
if deleted_in:
|
if deleted_in:
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
<h3>Current Backups</h3>
|
<h3>Current Backups</h3>
|
||||||
|
|
||||||
<p>The backup directory currently contains the backups listed below. The total size on disk of the backups is <span id="backup-total-size"></span>.</p>
|
<p>The backup directory currently contains the backups listed below. The total size on disk of the backups is currently <span id="backup-total-size"></span>.</p>
|
||||||
|
|
||||||
<table id="backup-status" class="table" style="width: auto">
|
<table id="backup-status" class="table" style="width: auto">
|
||||||
<thead>
|
<thead>
|
||||||
@ -76,7 +76,7 @@ function show_system_backup() {
|
|||||||
if (b.deleted_in)
|
if (b.deleted_in)
|
||||||
tr.append( $('<td/>').text(b.deleted_in) );
|
tr.append( $('<td/>').text(b.deleted_in) );
|
||||||
else
|
else
|
||||||
tr.append( $('<td class="text-muted">n/a</td>') );
|
tr.append( $('<td class="text-muted">unknown</td>') );
|
||||||
$('#backup-status tbody').append(tr);
|
$('#backup-status tbody').append(tr);
|
||||||
|
|
||||||
total_disk_size += b.size;
|
total_disk_size += b.size;
|
||||||
|
Loading…
Reference in New Issue
Block a user