diff options
-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 |