From 3d381297f25b0bbb4aac98cdea5f74adf096cf6d Mon Sep 17 00:00:00 2001 From: GRMrGecko Date: Thu, 29 Dec 2022 16:03:17 -0600 Subject: [PATCH] Add domain specific option --- kvm-backup-images.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kvm-backup-images.sh b/kvm-backup-images.sh index 140e694..2f470b8 100644 --- a/kvm-backup-images.sh +++ b/kvm-backup-images.sh @@ -19,6 +19,9 @@ export BORG_DELETE_I_KNOW_WHAT_I_AM_DOING=NO # Set to empty string to disable pruning. PRUNE_OPTIONS="--keep-daily 7 --keep-weekly 4 --keep-monthly 6" +# Allows providing an argument of a domain to specifically backup. +BACKUP_DOMAIN="$1" + # I save the status in a temporary file so I can error out and exit if a failure occurs. DOMLIST_STATUS_TMP="/tmp/backup-image-domlist-tmp" while read -r line; do @@ -31,6 +34,11 @@ while read -r line; do continue fi + # If a backup domain was provided, we're only going to backup that domain. + if [ -n "$BACKUP_DOMAIN" ] && [[ "$BACKUP_DOMAIN" != "$DOMAIN" ]]; then + continue + fi + # Get the images that need backing up. DEVS=() IMAGES=()