Fix for ftp backup on RHEL5 and Ubuntu

This commit is contained in:
Serghey Rodin 2013-10-12 19:35:06 +03:00
commit 735067aa1a
2 changed files with 11 additions and 8 deletions

View file

@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf
# Defining ftp command function
ftpc() {
ftp -n $host $ftp_port <<EOF
ftp -p -n $host $ftp_port <<EOF
quote USER $ftp_user
quote PASS $ftp_password
binary
@ -48,8 +48,9 @@ validate_format 'host' 'ftp_user' 'ftp_password'
#----------------------------------------------------------#
# Checking network connection
ftp_connect=$(ftpc)
if [ ! -z "$(echo $ftp_connect |grep -i -e error -e 'not connected')" ]; then
fconn=$(ftpc)
ferror=$(echo $fconn |grep -i -e failed -e error -e "Can't" -e "not conn")
if [ ! -z "$ferror" ]; then
echo "Error: can't login to ftp"
log_event "$E_CONNECT" "$EVENT"
exit $E_CONNECT
@ -57,7 +58,7 @@ fi
# Checking write permissions
ftpc "mkdir $ftp_path" > /dev/null 2>&1
ftmpdir=$(mktemp -u -p "$ftp_path")
ftmpdir="$ftp_path/vst.bK76A9SUkt"
ftp_result=$(ftpc "mkdir $ftmpdir" "rm $ftmpdir"|grep -v Trying)
if [ ! -z "$ftp_result" ] ; then
echo "$ftp_result"