dsnap-sync: cleanup global variable assignment
* declare defaults * assign integer values * evaluate command Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
@@ -52,12 +52,16 @@ exec 3>$PIPE 4>$BTRFS_PIPE
|
|||||||
# global variables
|
# global variables
|
||||||
args=
|
args=
|
||||||
answer=no
|
answer=no
|
||||||
|
batch=0
|
||||||
|
color=0
|
||||||
donotify=0
|
donotify=0
|
||||||
|
dryrun=0
|
||||||
disk_count=-1
|
disk_count=-1
|
||||||
disk_uuid_match_count=0
|
disk_uuid_match_count=0
|
||||||
disk_target_match_count=0
|
disk_target_match_count=0
|
||||||
disk_subvolid_match_count=0
|
disk_subvolid_match_count=0
|
||||||
disk_uuid_match=''
|
disk_uuid_match=''
|
||||||
|
interactive=1
|
||||||
selected_uuid='none'
|
selected_uuid='none'
|
||||||
selected_target='none'
|
selected_target='none'
|
||||||
selected_subvol='none'
|
selected_subvol='none'
|
||||||
@@ -96,7 +100,7 @@ check_prerequisites () {
|
|||||||
|
|
||||||
# optional binaries:
|
# optional binaries:
|
||||||
which notify-send >/dev/null 2>&1 && { donotify=1; }
|
which notify-send >/dev/null 2>&1 && { donotify=1; }
|
||||||
which pv >/dev/null 2>&1 && { do_pv_cmd=true; }
|
which pv >/dev/null 2>&1 && { do_pv_cmd=1; }
|
||||||
|
|
||||||
if [ $(id -u) -ne 0 ] ; then printf "$progname: must be run as root\n" ; exit 1 ; fi
|
if [ $(id -u) -ne 0 ] ; then printf "$progname: must be run as root\n" ; exit 1 ; fi
|
||||||
|
|
||||||
@@ -112,7 +116,7 @@ check_prerequisites () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_snapper_failed_ids () {
|
check_snapper_failed_ids () {
|
||||||
local batch=${1:-$false}
|
local batch=${1:-0}
|
||||||
|
|
||||||
# active, non finished snapshot backups are marked with a reasonable string
|
# active, non finished snapshot backups are marked with a reasonable string
|
||||||
# default: $(snap_description_running -> "$progname backup in progress" (userdata: host=$source)
|
# default: $(snap_description_running -> "$progname backup in progress" (userdata: host=$source)
|
||||||
@@ -153,7 +157,7 @@ create_snapshot () {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# acting on source system
|
# acting on source system
|
||||||
if [ ! $dryrun ]; then
|
if [ $dryrun -eq 0 ]; then
|
||||||
#printf "Creating new snapshot with snapper config '%s' ...\n" "$selected_config" | tee $PIPE
|
#printf "Creating new snapshot with snapper config '%s' ...\n" "$selected_config" | tee $PIPE
|
||||||
if [ $verbose -ge 2 ]; then
|
if [ $verbose -ge 2 ]; then
|
||||||
printf "${MAGENTA}Create new snapshot using snapper config ${GREEN}'%s'${MAGENTA}...${NO_COLOR}\n" \
|
printf "${MAGENTA}Create new snapshot using snapper config ${GREEN}'%s'${MAGENTA}...${NO_COLOR}\n" \
|
||||||
@@ -692,7 +696,7 @@ parse_params () {
|
|||||||
-n|--noconfirm|--batch)
|
-n|--noconfirm|--batch)
|
||||||
batch=1
|
batch=1
|
||||||
interactive=0
|
interactive=0
|
||||||
do_pv_cmd=false
|
do_pv_cmd=1
|
||||||
donotify=0
|
donotify=0
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
@@ -705,7 +709,7 @@ parse_params () {
|
|||||||
shift 1
|
shift 1
|
||||||
;;
|
;;
|
||||||
--nopv)
|
--nopv)
|
||||||
do_pv_cmd=false
|
do_pv_cmd=0
|
||||||
shift 1
|
shift 1
|
||||||
;;
|
;;
|
||||||
-p|--port)
|
-p|--port)
|
||||||
@@ -889,15 +893,15 @@ parse_params () {
|
|||||||
printf " backup synced: '%s'\n" "$snap_description_synced"
|
printf " backup synced: '%s'\n" "$snap_description_synced"
|
||||||
|
|
||||||
if [ $verbose -ge 1 ]; then snap_sync_options="verbose_level=$verbose"; fi
|
if [ $verbose -ge 1 ]; then snap_sync_options="verbose_level=$verbose"; fi
|
||||||
if [ "$dryrun" ]; then snap_sync_options="${snap_sync_options} dry-run=true"; fi
|
if [ $dryrun -eq 1 ]; then snap_sync_options="${snap_sync_options} dry-run=true"; fi
|
||||||
if [ "$nonotify" ]; then snap_sync_options="${snap_sync_options} donotify=0"; fi
|
if [ $donotify -eq 1 ]; then snap_sync_options="${snap_sync_options} donotify=true"; fi
|
||||||
if [ "$color" ]; then snap_sync_options="${snap_sync_options} color=true"; fi
|
if [ $color -eq 1 ]; then snap_sync_options="${snap_sync_options} color=true"; fi
|
||||||
if [ "$batch" ]; then
|
if [ $batch -eq 1 ]; then
|
||||||
snap_sync_options="${snap_sync_options} batch=true do_pv_cmd=false"
|
snap_sync_options="${snap_sync_options} batch=true do_pv_cmd=false"
|
||||||
else
|
else
|
||||||
snap_sync_options="${snap_sync_options} do_pv_cmd=$do_pv_cmd"
|
snap_sync_options="${snap_sync_options} interactive=true do_pv_cmd=$do_pv_cmd"
|
||||||
fi
|
fi
|
||||||
if [ "$interactive" ]; then snap_sync_options="${snap_sync_options} interactive=true batch=false"; fi
|
#if [ "$interactive" -eq 1 ]; then snap_sync_options="${snap_sync_options} interactive=true"; fi
|
||||||
printf "Options: '%s'\n\n" "${snap_sync_options}"
|
printf "Options: '%s'\n\n" "${snap_sync_options}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -1142,7 +1146,7 @@ run_backup () {
|
|||||||
snapper_source_snapshot_size=$(($snapper_source_snapshot_size / 1024 / 1024))G
|
snapper_source_snapshot_size=$(($snapper_source_snapshot_size / 1024 / 1024))G
|
||||||
|
|
||||||
# settings for interactive progress status
|
# settings for interactive progress status
|
||||||
if [ "$do_pv_cmd" = "true" ]; then
|
if [ "$do_pv_cmd" ]; then
|
||||||
pv_options="--delay-start 2 --interval 5 --format \"time elapsed [%t] | rate %r | total size [%b] | %p | time remaining [%e]\" "
|
pv_options="--delay-start 2 --interval 5 --format \"time elapsed [%t] | rate %r | total size [%b] | %p | time remaining [%e]\" "
|
||||||
cmd_pv="pv --size $snapper_source_snapshot_size $pv_options |"
|
cmd_pv="pv --size $snapper_source_snapshot_size $pv_options |"
|
||||||
#cmd_pv="pv $pv_options --size ${snapper_source_snapshot_size} | dialog --gauge \"$progname: Progress for config '$selected_config'\" 6 85 |"
|
#cmd_pv="pv $pv_options --size ${snapper_source_snapshot_size} | dialog --gauge \"$progname: Progress for config '$selected_config'\" 6 85 |"
|
||||||
@@ -1151,7 +1155,7 @@ run_backup () {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cmd="btrfs send $verbose_flag $snapper_source_snapshot 2>$BTRFS_PIPE | $cmd_pv $ssh btrfs receive $verbose_flag $snapper_target_snapshot 2>$BTRFS_PIPE"
|
cmd="btrfs send $verbose_flag $snapper_source_snapshot 2>$BTRFS_PIPE | $cmd_pv $ssh btrfs receive $verbose_flag $snapper_target_snapshot 2>$BTRFS_PIPE"
|
||||||
if [ ! "$dryrun" ]; then
|
if [ "$dryrun" -eq 0 ]; then
|
||||||
if [ "$snapper_source_sync_id" -eq 0 ] || [ "$snapper_target_sync_id" -eq 0 ]; then
|
if [ "$snapper_source_sync_id" -eq 0 ] || [ "$snapper_target_sync_id" -eq 0 ]; then
|
||||||
# target never received any snapshot before
|
# target never received any snapshot before
|
||||||
if [ $verbose -ge 1 ]; then
|
if [ $verbose -ge 1 ]; then
|
||||||
@@ -1239,7 +1243,7 @@ run_backup () {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# finally: send the snapper info metadata
|
# finally: send the snapper info metadata
|
||||||
if [ ! $dryrun ]; then
|
if [ $dryrun -eq 0 ]; then
|
||||||
if [ -z "$remote" ]; then
|
if [ -z "$remote" ]; then
|
||||||
cmd="cp $snapper_source_info $snapper_target_snapshot"
|
cmd="cp $snapper_source_info $snapper_target_snapshot"
|
||||||
cp "$snapper_source_info" "$snapper_target_snapshot"
|
cp "$snapper_source_info" "$snapper_target_snapshot"
|
||||||
@@ -1270,7 +1274,7 @@ run_cleanup () {
|
|||||||
|
|
||||||
printf "${BLUE}Performing cleanup ...${NO_COLOR}\n"
|
printf "${BLUE}Performing cleanup ...${NO_COLOR}\n"
|
||||||
|
|
||||||
if [ ! $dryrun ]; then
|
if [ $dryrun -eq 0 ]; then
|
||||||
# cleanup failed runs
|
# cleanup failed runs
|
||||||
check_snapper_failed_ids "$batch"
|
check_snapper_failed_ids "$batch"
|
||||||
|
|
||||||
@@ -1342,7 +1346,7 @@ run_finalize () {
|
|||||||
if [ $verbose -ge 1 ]; then
|
if [ $verbose -ge 1 ]; then
|
||||||
printf "${MAGENTA}Tagging target ...${NO_COLOR}\n"
|
printf "${MAGENTA}Tagging target ...${NO_COLOR}\n"
|
||||||
fi
|
fi
|
||||||
if [ ! "$dryrun" ]; then
|
if [ "$dryrun" -eq 0 ]; then
|
||||||
# target snapshot
|
# target snapshot
|
||||||
# 1) wait for target snapshot to show up in snapper list
|
# 1) wait for target snapshot to show up in snapper list
|
||||||
# find "$snapper_target_sync_id" -> marked as "$snap_descrition_running"
|
# find "$snapper_target_sync_id" -> marked as "$snap_descrition_running"
|
||||||
@@ -1387,7 +1391,7 @@ run_finalize () {
|
|||||||
|
|
||||||
while [ "$ii" -le "$ii_max" ]; do
|
while [ "$ii" -le "$ii_max" ]; do
|
||||||
if [ $verbose -ge 2 ]; then
|
if [ $verbose -ge 2 ]; then
|
||||||
printf "calling: '%s'\n" "$cmd"
|
printf "calling: '%s'\n" "$(eval $cmd)"
|
||||||
fi
|
fi
|
||||||
ret=$(eval $cmd)
|
ret=$(eval $cmd)
|
||||||
#ret=$ssh snapper --verbose --config \"$snapper_target_config\" list --type single \
|
#ret=$ssh snapper --verbose --config \"$snapper_target_config\" list --type single \
|
||||||
@@ -1405,7 +1409,7 @@ run_finalize () {
|
|||||||
if [ $verbose -ge 2 ]; then
|
if [ $verbose -ge 2 ]; then
|
||||||
printf "${MAGENTA}Tagging metadata${NO_COLOR} for snapper id ${GREEN}'%s'${NO_COLOR} on target for configuration ${GREEN}'%s'${NO_COLOR} ...\n" \
|
printf "${MAGENTA}Tagging metadata${NO_COLOR} for snapper id ${GREEN}'%s'${NO_COLOR} on target for configuration ${GREEN}'%s'${NO_COLOR} ...\n" \
|
||||||
"$snapper_target_id" "$snapper_target_config"
|
"$snapper_target_id" "$snapper_target_config"
|
||||||
#printf "calling: '%s'\n" "$cmd"
|
#printf "calling: '%s'\n" "$(eval $cmd)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# call command (respect needed quotes)
|
# call command (respect needed quotes)
|
||||||
@@ -1452,7 +1456,7 @@ run_finalize () {
|
|||||||
if [ $verbose -ge 2 ]; then
|
if [ $verbose -ge 2 ]; then
|
||||||
printf "${MAGENTA}Tagging snapper metadata${NO_COLOR} for snapper id ${GREEN}'%s'${NO_COLOR} on source for configuration ${GREEN}'%s'${NO_COLOR} ...\n" \
|
printf "${MAGENTA}Tagging snapper metadata${NO_COLOR} for snapper id ${GREEN}'%s'${NO_COLOR} on source for configuration ${GREEN}'%s'${NO_COLOR} ...\n" \
|
||||||
"$snapper_source_id" "$selected_config"
|
"$snapper_source_id" "$selected_config"
|
||||||
printf "calling: '%s'\n" "$cmd"
|
printf "calling: '%s'\n" "$(eval $cmd)"
|
||||||
fi
|
fi
|
||||||
ret=$(eval "$cmd")
|
ret=$(eval "$cmd")
|
||||||
if [ $verbose -ge 2 ]; then
|
if [ $verbose -ge 2 ]; then
|
||||||
@@ -1468,7 +1472,7 @@ run_finalize () {
|
|||||||
if [ $verbose -ge 2 ]; then
|
if [ $verbose -ge 2 ]; then
|
||||||
printf "${MAGENTA}Tagging snapper metadata${NO_COLOR} for snapper sync id ${GREEN}'%s'${NO_COLOR} on source for configuration ${GREEN}'%s'${NO_COLOR} ...\n" \
|
printf "${MAGENTA}Tagging snapper metadata${NO_COLOR} for snapper sync id ${GREEN}'%s'${NO_COLOR} on source for configuration ${GREEN}'%s'${NO_COLOR} ...\n" \
|
||||||
"$snapper_source_sync_id" "$selected_config"
|
"$snapper_source_sync_id" "$selected_config"
|
||||||
printf "calling: '%s'\n" "$cmd"
|
printf "calling: '%s'\n" "$(eval $cmd)"
|
||||||
fi
|
fi
|
||||||
ret=$(eval "$cmd")
|
ret=$(eval "$cmd")
|
||||||
snapper_source_sync_snapshot=$SUBVOLUME/.snapshots/$snapper_source_sync_id/snapshot
|
snapper_source_sync_snapshot=$SUBVOLUME/.snapshots/$snapper_source_sync_id/snapshot
|
||||||
@@ -1585,12 +1589,10 @@ select_target_disk () {
|
|||||||
selected_uuid=$(eval echo \$disk_uuid_$disk_selected)
|
selected_uuid=$(eval echo \$disk_uuid_$disk_selected)
|
||||||
selected_target=$(eval echo \$disk_target_$disk_selected)
|
selected_target=$(eval echo \$disk_target_$disk_selected)
|
||||||
selected_subvol=$(eval echo \$fs_options_$disk_selected | sed -e 's/.*subvolid=\([0-9]*\).*/\1/')
|
selected_subvol=$(eval echo \$fs_options_$disk_selected | sed -e 's/.*subvolid=\([0-9]*\).*/\1/')
|
||||||
if [ "$dryrun" ]; then
|
|
||||||
printf "Selected Subvol-ID=%s: %s on %s\n" "$selected_subvol" "$selected_target" "$selected_uuid"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $verbose -ge 1 ]; then
|
if [ $verbose -ge 1 ]; then
|
||||||
printf "${MAGENTA}You selected the disk with UUID ${GREEN}'%s'${MAGENTA} (subvolid=${GREEN}'%s'${MAGENTA})${NO_COLOR}.\n" "$selected_uuid" "$selected_subvol"
|
printf "${MAGENTA}You selected the disk with UUID ${GREEN}'%s'${MAGENTA} (subvolid=${GREEN}'%s'${MAGENTA})${NO_COLOR}.\n" \
|
||||||
|
"$selected_uuid" "$selected_subvol"
|
||||||
if [ -z "$remote" ]; then
|
if [ -z "$remote" ]; then
|
||||||
printf "${MAGENTA}Target disk is mounted at ${GREEN}'%s'${MAGENTA}.${NO_COLOR}\n" \
|
printf "${MAGENTA}Target disk is mounted at ${GREEN}'%s'${MAGENTA}.${NO_COLOR}\n" \
|
||||||
"$selected_target"
|
"$selected_target"
|
||||||
@@ -1709,7 +1711,7 @@ verify_archive_structure () {
|
|||||||
# if not accessible, create backup-path
|
# if not accessible, create backup-path
|
||||||
cmd="$ssh stat --format %i $backup_root 2>/dev/null"
|
cmd="$ssh stat --format %i $backup_root 2>/dev/null"
|
||||||
if [ -z $(eval $cmd) ]; then
|
if [ -z $(eval $cmd) ]; then
|
||||||
if [ ! "$dryrun" ]; then
|
if [ "$dryrun" -eq 0 ]; then
|
||||||
if [ $verbose -ge 1 ]; then
|
if [ $verbose -ge 1 ]; then
|
||||||
if [ -z $remote_host ]; then
|
if [ -z $remote_host ]; then
|
||||||
printf "Create backup-path %s ...\n" \
|
printf "Create backup-path %s ...\n" \
|
||||||
@@ -1719,7 +1721,7 @@ verify_archive_structure () {
|
|||||||
"$remote_host" "$backup_root"
|
"$remote_host" "$backup_root"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ ! $dryrun ]; then
|
if [ $dryrun -eq 0 ]; then
|
||||||
$(eval $ssh mkdir --mode=0700 --parents $backup_root)
|
$(eval $ssh mkdir --mode=0700 --parents $backup_root)
|
||||||
else
|
else
|
||||||
if [ -z $remote_host ]; then
|
if [ -z $remote_host ]; then
|
||||||
@@ -1742,7 +1744,7 @@ verify_archive_structure () {
|
|||||||
# 2) loop though ordered incremental path: btrfs recieve the stream
|
# 2) loop though ordered incremental path: btrfs recieve the stream
|
||||||
|
|
||||||
# verify that target can take the new archive for given snapshot id
|
# verify that target can take the new archive for given snapshot id
|
||||||
if [ ! "$dryrun" ]; then
|
if [ "$dryrun" -eq 0 ]; then
|
||||||
if [ $verbose -ge 2 ]; then
|
if [ $verbose -ge 2 ]; then
|
||||||
printf "${MAGENTA}Verify existence of path ${GREEN}'%s'${NO_COLOR}\n" \
|
printf "${MAGENTA}Verify existence of path ${GREEN}'%s'${NO_COLOR}\n" \
|
||||||
"$backup_root/$snapper_config/$snapper_id"
|
"$backup_root/$snapper_config/$snapper_id"
|
||||||
@@ -1862,8 +1864,9 @@ verify_snapper_structure () {
|
|||||||
|
|
||||||
# if not accessible, create backup-path
|
# if not accessible, create backup-path
|
||||||
cmd="$ssh stat --format %i $backup_root 2>/dev/null"
|
cmd="$ssh stat --format %i $backup_root 2>/dev/null"
|
||||||
if [ -z $(eval $cmd) ]; then
|
ret=$(eval $cmd)
|
||||||
if [ ! "$dryrun" ]; then
|
if [ $? -eq 1 ]; then
|
||||||
|
if [ "$dryrun" -eq 0 ]; then
|
||||||
if [ $verbose -ge 2 ]; then
|
if [ $verbose -ge 2 ]; then
|
||||||
if [ -z $remote_host ]; then
|
if [ -z $remote_host ]; then
|
||||||
printf "${MAGENTA}Create${NO_COLOR} new backup-path ${GREEN}'%s'${NO_COLOR}...\n" \
|
printf "${MAGENTA}Create${NO_COLOR} new backup-path ${GREEN}'%s'${NO_COLOR}...\n" \
|
||||||
@@ -1875,7 +1878,7 @@ verify_snapper_structure () {
|
|||||||
fi
|
fi
|
||||||
# strip last dir from backup_root
|
# strip last dir from backup_root
|
||||||
base_path=${backup_root%/*}; echo $base_path
|
base_path=${backup_root%/*}; echo $base_path
|
||||||
if [ ! $dryrun ]; then
|
if [ $dryrun -eq 0 ]; then
|
||||||
$(eval $ssh mkdir --mode=0700 --parents $base_path)
|
$(eval $ssh mkdir --mode=0700 --parents $base_path)
|
||||||
else
|
else
|
||||||
if [ -z $remote_host ]; then
|
if [ -z $remote_host ]; then
|
||||||
@@ -1891,8 +1894,10 @@ verify_snapper_structure () {
|
|||||||
|
|
||||||
# verify that we have a snapper compatible structure for target config (a btrfs subvolume)
|
# verify that we have a snapper compatible structure for target config (a btrfs subvolume)
|
||||||
cmd="$ssh stat --format %i $backup_root 2>/dev/null"
|
cmd="$ssh stat --format %i $backup_root 2>/dev/null"
|
||||||
if [ -z $(eval $cmd) ]; then
|
ret=$(eval $cmd)
|
||||||
if [ ! "$dryrun" ]; then
|
if [ $? -eq 1 ]; then
|
||||||
|
# path does not exist
|
||||||
|
if [ $dryrun -eq 0 ]; then
|
||||||
if [ $verbose -ge 1 ]; then
|
if [ $verbose -ge 1 ]; then
|
||||||
if [ -z "$remote" ]; then
|
if [ -z "$remote" ]; then
|
||||||
printf "${MAGENTA}Create${NO_COLOR} new snapper capable BTRFS ${MAGENTA}subvolume ${GREEN}'%s'${NO_COLOR} ...\n" \
|
printf "${MAGENTA}Create${NO_COLOR} new snapper capable BTRFS ${MAGENTA}subvolume ${GREEN}'%s'${NO_COLOR} ...\n" \
|
||||||
@@ -1952,10 +1957,12 @@ verify_snapper_structure () {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# verify that we have a valid snapper config
|
# verify that we have a valid snapper config
|
||||||
if [ ! "$dryrun" ]; then
|
if [ $dryrun -eq 0 ]; then
|
||||||
cmd="$ssh stat --format %i $SNAPPER_CONFIG_DIR/$snapper_config 2>/dev/null"
|
cmd="$ssh stat --format %i $SNAPPER_CONFIG_DIR/$snapper_config 2>/dev/null"
|
||||||
if [ -z $(eval $cmd) ]; then
|
ret=$(eval $cmd)
|
||||||
# snapper will create new structure at $backup_root/.snapshots
|
if [ $? -eq 1 ]; then
|
||||||
|
# path does not exist, let snapper create the structure
|
||||||
|
# and path $backup_root/.snapshots
|
||||||
cmd="$ssh snapper --config $snapper_config create-config \
|
cmd="$ssh snapper --config $snapper_config create-config \
|
||||||
--template $snapper_subvolume_template \
|
--template $snapper_subvolume_template \
|
||||||
--fstype btrfs $backup_root"
|
--fstype btrfs $backup_root"
|
||||||
@@ -2020,13 +2027,15 @@ verify_snapper_structure () {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# verify that target snapshot can take the new snapshot data id
|
# verify that target snapshot can take the new snapshot data id
|
||||||
if [ ! "$dryrun" ]; then
|
if [ $dryrun -eq 0 ]; then
|
||||||
if [ $verbose -ge 1 ]; then
|
if [ $verbose -ge 1 ]; then
|
||||||
printf "${MAGENTA}Verify existence of path ${GREEN}'%s'${NO_COLOR}...\n" \
|
printf "${MAGENTA}Verify existence of path ${GREEN}'%s'${NO_COLOR}...\n" \
|
||||||
"$backup_root/$snapper_snapshots/$snapper_id"
|
"$backup_root/$snapper_snapshots/$snapper_id"
|
||||||
fi
|
fi
|
||||||
cmd="$ssh stat --format %i $backup_root/$snapper_snapshots/$snapper_id 2>/dev/null"
|
cmd="$ssh stat --format %i $backup_root/$snapper_snapshots/$snapper_id 2>/dev/null"
|
||||||
if [ -z "$(eval $cmd)" ]; then
|
ret=$(eval $cmd)
|
||||||
|
if [ $? -eq 1 ]; then
|
||||||
|
# Path does not exist
|
||||||
if [ $verbose -ge 2 ]; then
|
if [ $verbose -ge 2 ]; then
|
||||||
printf "${MAGENTA}Create${NO_COLOR} path ${GREEN}'%s'${NO_COLOR} to store target snapshot.\n" \
|
printf "${MAGENTA}Create${NO_COLOR} path ${GREEN}'%s'${NO_COLOR} to store target snapshot.\n" \
|
||||||
"$backup_root/$snapper_snapshots/$snapper_id"
|
"$backup_root/$snapper_snapshots/$snapper_id"
|
||||||
|
|||||||
Reference in New Issue
Block a user