summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbackup.sh24
1 files changed, 13 insertions, 11 deletions
diff --git a/backup.sh b/backup.sh
index 00431a0..95ce921 100755
--- a/backup.sh
+++ b/backup.sh
@@ -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