From 8b57aa2a04734ec440683191ce049e80fe6900f6 Mon Sep 17 00:00:00 2001 From: Pavel Dmitriev <90725813+PavelMXFox@users.noreply.github.com> Date: Tue, 2 Nov 2021 12:10:54 +0300 Subject: [PATCH] Update backup.sh --- backup.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/backup.sh b/backup.sh index 94b64df..d937672 100755 --- a/backup.sh +++ b/backup.sh @@ -106,13 +106,15 @@ rm -f $prefix/$stamp/* rmdir $prefix/$stamp # Sending data - -for xfile_item in `ls ${prefix}/compressed` -do - scp -B -i ${sshkey} ${prefix}/compressed/${xfile_item} ${sshuser}@${sshhost}:${sshpath} > /dev/null - if [ "$?" == 0 ] - then - rm -f ${prefix}/compressed/${xfile_item} - fi -done +if [ -n "${sshhost}" ] +then + for xfile_item in `ls ${prefix}/compressed` + do + scp -B -i ${sshkey} ${prefix}/compressed/${xfile_item} ${sshuser}@${sshhost}:${sshpath} > /dev/null + if [ "$?" == 0 ] + then + rm -f ${prefix}/compressed/${xfile_item} + fi + done +fi