mirror of
https://github.com/myvesta/vesta
synced 2025-08-20 13:24:25 -07:00
informative errors + sftp_path fix
This commit is contained in:
parent
3c3a399fd6
commit
8f2baae014
1 changed files with 14 additions and 12 deletions
|
@ -96,6 +96,7 @@ EOF
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
if [ "$type" != 'local' ];then
|
||||||
check_args '4' "$#" "TYPE HOST USERNAME PASSWORD [PATH] [PORT]"
|
check_args '4' "$#" "TYPE HOST USERNAME PASSWORD [PATH] [PORT]"
|
||||||
validate_format 'host' 'user'
|
validate_format 'host' 'user'
|
||||||
is_password_valid
|
is_password_valid
|
||||||
|
@ -107,6 +108,7 @@ if [ "$type" = 'sftp' ]; then
|
||||||
exit $E_NOTEXIST
|
exit $E_NOTEXIST
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
@ -122,7 +124,7 @@ if [ "$type" = 'ftp' ]; then
|
||||||
ferror=$(echo $fconn |\
|
ferror=$(echo $fconn |\
|
||||||
grep -i -e failed -e error -e "can't" -e "not conn" -e "incorrect")
|
grep -i -e failed -e error -e "can't" -e "not conn" -e "incorrect")
|
||||||
if [ ! -z "$ferror" ]; then
|
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"
|
log_event "$E_CONNECT" "$EVENT"
|
||||||
exit $E_CONNECT
|
exit $E_CONNECT
|
||||||
fi
|
fi
|
||||||
|
@ -143,12 +145,12 @@ if [ "$type" = 'sftp' ]; then
|
||||||
if [ -z $port ]; then
|
if [ -z $port ]; then
|
||||||
port=22
|
port=22
|
||||||
fi
|
fi
|
||||||
sftmpdir="$sftp_path/vst.bK76A9SUkt"
|
sftmpdir="$path/vst.bK76A9SUkt"
|
||||||
sftpc "mkdir $sftmpdir" "rmdir $sftmpdir" > /dev/null 2>&1
|
sftpc "mkdir $sftmpdir" "rmdir $sftmpdir" > /dev/null 2>&1
|
||||||
rc=$?
|
rc=$?
|
||||||
if [[ "$rc" != 0 ]]; then
|
if [[ "$rc" != 0 ]]; then
|
||||||
case $rc in
|
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";;
|
$E_FTP) echo "Error: can't create temp folder on the sftp host";;
|
||||||
esac
|
esac
|
||||||
log_event "$rc" "$EVENT"
|
log_event "$rc" "$EVENT"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue