From 3bf6a399a5c160c0ca5d5f5d209257130f11d377 Mon Sep 17 00:00:00 2001 From: neil Date: Tue, 26 Apr 2016 23:12:35 +0800 Subject: [PATCH] make path first, in case the part doesn't exist. make path first, in case the part doesn't exist. --- bin/v-add-backup-host | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/v-add-backup-host b/bin/v-add-backup-host index 5595c043..39a79046 100755 --- a/bin/v-add-backup-host +++ b/bin/v-add-backup-host @@ -137,8 +137,10 @@ if [ "$type" = 'sftp' ]; then if [ -z $port ]; then port=22 fi - sftmpdir="$path/vst.bK76A9SUkt" - sftpc "mkdir $sftmpdir" "rmdir $sftmpdir" > /dev/null 2>&1 + if sftpc "mkdir $path" > /dev/null 2>&1 ; then + sftmpdir="$path/vst.bK76A9SUkt" + sftpc "mkdir $sftmpdir" "rmdir $sftmpdir" > /dev/null 2>&1 + fi rc=$? if [[ "$rc" != 0 ]]; then case $rc in