Skip to content

Commit

Permalink
Support for separate retention settings for external backups (to othe…
Browse files Browse the repository at this point in the history
…r partition/disk)
  • Loading branch information
nazar-pc committed Jun 8, 2015
1 parent 00621ae commit 2bc3f67
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 0.x (Unreleased yet)
# 0.6 (08 June, 2015)
* Radically improve speed of incremental backups (check recent snapshots first)
* Support for separate retention settings for external backups (to other partition/disk)

# 0.5 (17 May, 2015)
* Code moved into class
Expand Down
4 changes: 2 additions & 2 deletions just-backup-btrfs.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @author Nazar Mokrynskyi <[email protected]>
* @copyright Copyright (c) 2014-2015, Nazar Mokrynskyi
* @license http://opensource.org/licenses/MIT
* @version 0.5
* @version 0.6
*/
class Just_backup_btrfs {
/**
Expand Down Expand Up @@ -140,7 +140,7 @@ protected function do_backup_external ($config, $history_db, $snapshot, $comment
if (!$history_db_external) {
return;
}
list($keep_year, $keep_month, $keep_day, $keep_hour) = $this->how_long_to_keep($history_db_external, $config['keep_snapshots']);
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']);
if (!$keep_hour) {
return;
}
Expand Down
7 changes: 7 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,19 @@ Configuration options are especially made self-explanatory:
"day" : 48,
"month" : 60,
"year" : 96
},
"keep_other_snapshots" : {
"hour" : -1,
"day" : 96,
"month" : 120,
"year" : 192
}
}
]
```
Here you can use `-1` as value for `keep_snapshots` elements to allow storing of all created snapshots.
Also `destination_other_partition` might be `false` or path on some other BTRFS partition (even on other drive) to create backups, not just snapshots.
If `keep_other_snapshots` option is present - it will be used for `destination_other_partition` instead of `keep_snapshots`.
Most options should be obvious

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

0 comments on commit 2bc3f67

Please sign in to comment.