fix backup array
This commit is contained in:
@@ -161,6 +161,7 @@ fi
|
|||||||
selected_configs=${selected_configs:-$SNAPPER_CONFIGS}
|
selected_configs=${selected_configs:-$SNAPPER_CONFIGS}
|
||||||
|
|
||||||
# Initial configuration of where backup directories are
|
# Initial configuration of where backup directories are
|
||||||
|
i=0
|
||||||
for x in $selected_configs; do
|
for x in $selected_configs; do
|
||||||
|
|
||||||
SNAP_SYNC_EXCLUDE=no
|
SNAP_SYNC_EXCLUDE=no
|
||||||
@@ -193,13 +194,17 @@ for x in $selected_configs; do
|
|||||||
error_exit
|
error_exit
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
BACKUPDIRS_ARRAY[$x]=$BACKUPDIR
|
BACKUPDIRS_ARRAY[$i]=$BACKUPDIR
|
||||||
|
i=$(($i+1))
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Actual backing up
|
# Actual backing up
|
||||||
|
i=-1
|
||||||
for x in $selected_configs; do
|
for x in $selected_configs; do
|
||||||
|
|
||||||
|
i=$(($i+1))
|
||||||
|
|
||||||
if [[ "$(sudo snapper -c $x list -t single | awk '/'$name' backup in progress/ {cnt++} END {print cnt}')" -gt 0 ]]; then
|
if [[ "$(sudo snapper -c $x list -t single | awk '/'$name' backup in progress/ {cnt++} END {print cnt}')" -gt 0 ]]; then
|
||||||
printf "\nNOTE: Previous failed $name backup snapshots found for '$x'.\n" | tee $PIPE
|
printf "\nNOTE: Previous failed $name backup snapshots found for '$x'.\n" | tee $PIPE
|
||||||
fi
|
fi
|
||||||
@@ -222,7 +227,7 @@ for x in $selected_configs; do
|
|||||||
old_num=$(snapper -c "$x" list -t single | awk '/'"$selected_uuid"'/ {print $1}')
|
old_num=$(snapper -c "$x" list -t single | awk '/'"$selected_uuid"'/ {print $1}')
|
||||||
old_snap=$SUBVOLUME/.snapshots/$old_num/snapshot
|
old_snap=$SUBVOLUME/.snapshots/$old_num/snapshot
|
||||||
|
|
||||||
BACKUPDIR="${BACKUPDIRS_ARRAY[$x]}"
|
BACKUPDIR="${BACKUPDIRS_ARRAY[$i]}"
|
||||||
|
|
||||||
printf "Creating new snapshot for $x...\n" | tee $PIPE
|
printf "Creating new snapshot for $x...\n" | tee $PIPE
|
||||||
new_number=$(snapper -c "$x" create --print-number -d "$name backup in progress")
|
new_number=$(snapper -c "$x" create --print-number -d "$name backup in progress")
|
||||||
|
|||||||
Reference in New Issue
Block a user