diff options
author | Florian Pritz <bluewind@xinu.at> | 2020-01-25 15:52:22 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2020-01-25 15:52:22 +0100 |
commit | 767afdb44716815b616b5a829af9e7ae1de7ea2d (patch) | |
tree | 0804a82550320c2cffcad95c1c3880f46a650976 | |
parent | f8f9662cc38c6f973ce06643051c2a1359c2a885 (diff) | |
download | bin-767afdb44716815b616b5a829af9e7ae1de7ea2d.tar.gz bin-767afdb44716815b616b5a829af9e7ae1de7ea2d.tar.xz |
backup.sh: Only create backup-data files when in backup path
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-x | backup.sh | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -95,17 +95,19 @@ main() { # This is called before creating the backup pre_backup() { - # save some data that's useful for restores - local backupDataDir=/root/backup-data/ - mkdir -p "$backupDataDir" - fdisk -l > "$backupDataDir/fdisk" - vgdisplay > "$backupDataDir/vgdisplay" - pvdisplay > "$backupDataDir/pvdisplay" - lvdisplay > "$backupDataDir/lvdisplay" - df -a > "$backupDataDir/df" - findmnt -l > "$backupDataDir/findmnt" - mdadm --detail --scan > "$backupDataDir/mdadm" - vgcfgbackup --file "$backupDataDir/vgcfgbackup" + if in_array_startswith '/root/backup-data/' "${source_paths[@]}"; then + # save some data that's useful for restores + local backupDataDir=/root/backup-data/ + mkdir -p "$backupDataDir" + fdisk -l > "$backupDataDir/fdisk" + vgdisplay > "$backupDataDir/vgdisplay" + pvdisplay > "$backupDataDir/pvdisplay" + lvdisplay > "$backupDataDir/lvdisplay" + df -a > "$backupDataDir/df" + findmnt -l > "$backupDataDir/findmnt" + mdadm --detail --scan > "$backupDataDir/mdadm" + vgcfgbackup --file "$backupDataDir/vgcfgbackup" + fi # If you wish to use snapshots, create them here |