diff --git a/bin/v-add-backup-host b/bin/v-add-backup-host index cd35c39e8..77eeb0827 100755 --- a/bin/v-add-backup-host +++ b/bin/v-add-backup-host @@ -96,15 +96,17 @@ EOF # Verifications # #----------------------------------------------------------# -check_args '4' "$#" "TYPE HOST USERNAME PASSWORD [PATH] [PORT]" -validate_format 'host' 'user' -is_password_valid -if [ "$type" = 'sftp' ]; then - which expect >/dev/null 2>&1 - if [ $? -ne 0 ];then - echo "Error: expect utility not found" - log_event "$E_NOTEXIST" "$EVENT" - exit $E_NOTEXIST +if [ "$type" != 'local' ];then + check_args '4' "$#" "TYPE HOST USERNAME PASSWORD [PATH] [PORT]" + validate_format 'host' 'user' + is_password_valid + if [ "$type" = 'sftp' ]; then + which expect >/dev/null 2>&1 + if [ $? -ne 0 ];then + echo "Error: expect utility not found" + log_event "$E_NOTEXIST" "$EVENT" + exit $E_NOTEXIST + fi fi fi @@ -122,7 +124,7 @@ if [ "$type" = 'ftp' ]; then ferror=$(echo $fconn |\ grep -i -e failed -e error -e "can't" -e "not conn" -e "incorrect") if [ ! -z "$ferror" ]; then - echo "Error: can't login to ftp server" + echo "Error: can't login to ftp $user@$host" log_event "$E_CONNECT" "$EVENT" exit $E_CONNECT fi @@ -143,12 +145,12 @@ if [ "$type" = 'sftp' ]; then if [ -z $port ]; then port=22 fi - sftmpdir="$sftp_path/vst.bK76A9SUkt" + sftmpdir="$path/vst.bK76A9SUkt" sftpc "mkdir $sftmpdir" "rmdir $sftmpdir" > /dev/null 2>&1 rc=$? if [[ "$rc" != 0 ]]; then case $rc in - $E_CONNECT) echo "Error: can't login to sftp host";; + $E_CONNECT) echo "Error: can't login to sftp $user@$host";; $E_FTP) echo "Error: can't create temp folder on the sftp host";; esac log_event "$rc" "$EVENT"