Skip to content

Commit 2bc3f67

Browse files
committed
Support for separate retention settings for external backups (to other partition/disk)
1 parent 00621ae commit 2bc3f67

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

changelog.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# 0.x (Unreleased yet)
1+
# 0.6 (08 June, 2015)
22
* Radically improve speed of incremental backups (check recent snapshots first)
3+
* Support for separate retention settings for external backups (to other partition/disk)
34

45
# 0.5 (17 May, 2015)
56
* Code moved into class

just-backup-btrfs.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @author Nazar Mokrynskyi <[email protected]>
99
* @copyright Copyright (c) 2014-2015, Nazar Mokrynskyi
1010
* @license http://opensource.org/licenses/MIT
11-
* @version 0.5
11+
* @version 0.6
1212
*/
1313
class Just_backup_btrfs {
1414
/**
@@ -140,7 +140,7 @@ protected function do_backup_external ($config, $history_db, $snapshot, $comment
140140
if (!$history_db_external) {
141141
return;
142142
}
143-
list($keep_year, $keep_month, $keep_day, $keep_hour) = $this->how_long_to_keep($history_db_external, $config['keep_snapshots']);
143+
list($keep_year, $keep_month, $keep_day, $keep_hour) = $this->how_long_to_keep($history_db_external, isset($config['keep_other_snapshots']) ? $config['keep_other_snapshots'] : $config['keep_snapshots']);
144144
if (!$keep_hour) {
145145
return;
146146
}

readme.md

+7
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,19 @@ Configuration options are especially made self-explanatory:
9494
"day" : 48,
9595
"month" : 60,
9696
"year" : 96
97+
},
98+
"keep_other_snapshots" : {
99+
"hour" : -1,
100+
"day" : 96,
101+
"month" : 120,
102+
"year" : 192
97103
}
98104
}
99105
]
100106
```
101107
Here you can use `-1` as value for `keep_snapshots` elements to allow storing of all created snapshots.
102108
Also `destination_other_partition` might be `false` or path on some other BTRFS partition (even on other drive) to create backups, not just snapshots.
109+
If `keep_other_snapshots` option is present - it will be used for `destination_other_partition` instead of `keep_snapshots`.
103110
Most options should be obvious
104111

105112
Save this config as `/etc/just-backup-btrfs.json` and customize as you like.

0 commit comments

Comments
 (0)