Commit d771961
Add --archive.tar.binary parameter (#286)
* Add --archive.tar.binary parameter
Allows specifying a custom location of the "tar" command to use.
Also, the flags sent to "tar" are sent individually (`tar -cf` becomes `tar -c -f`).
This allows easily customizing how the archiving is performed without having to add
lots of new options. For example, you could encrypt backup data via a simple shell script
and specify it for --archive.tar.binary:
```
#!/bin/bash
gpg_pubkey_id=XXXXXXX
new_args=""
while [ "${#}" -gt 0 ]; do
case "$1" in
-f)
shift;
original_output_file="${1}"
shift
new_args="${new_args} --to-stdout"
;;
*)
new_args="${new_args} ${1}"
shift
;;
esac
done
tar ${new_args} | gpg --always-trust --encrypt --recipient ${gpg_pubkey_id} -z 0 --output ${original_output_file}
```
This has several advantages:
* Backups are never written to disk unencrypted
* Encryption can be done in one go, instead of causing the potentially heavy additional
I/O a separate encryption step would incur.
* It's transparent for the upload stages, so you can still benefit from the integrated
S3 (or other) uploads.
* Related: Fix flake8: Make regex a raw string1 parent 0f529ca commit d771961
File tree
3 files changed
+7
-4
lines changed- mongodb_consistent_backup/Archive/Tar
3 files changed
+7
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
| 38 | + | |
| 39 | + | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
0 commit comments