hello All,
I am doing SFTP using expect. We just change our server from sun solaris 8 to sun solaris 10.
The script was working good on sun solaris 8.
But it is giving problem on 10. from shell, SFTP is working fine.Please help me.
What can be the problem.
LIB_sftp_get()
{
_remote_file="$1"
_local_file="$2"
if [ -z "${_remote_file}" ] ; then
LIB_log_mail_exit "LIB_sftp_put(): no remote file"
fi
if [ -z "${_local_file}" ] ; then
_local_file="${_remote_file}"
fi
TMP_SFTP_ID="xx.xx.x.x"
TMP_SFTP_USERNAME="xxx"
TMP_SFTP_PASSWORD="xxxxx"
TMP_SFTP_REMOTE_DIR="xxxxxx"
TMP_SFTP_LOCAL_DIR="XXXXXX"
TMP_SFTP_TIMEOUT=-1
expect <<EOF
set timeout $TMP_SFTP_TIMEOUT
spawn sftp $TMP_SFTP_USERNAME@$TMP_SFTP_ID
expect "password:"
send "$TMP_SFTP_PASSWORD\r"
expect "sftp> "
send "lcd $TMP_SFTP_LOCAL_DIR \r"
expect "sftp> "
send "cd $TMP_SFTP_REMOTE_DIR \r"
expect "sftp> "
send "get ${_remote_file} ${_local_file} \r"
expect "sftp> "
send "bye \r"
EOF
if [ $? -ne 0 ] ; then
echo "Failed: LIB_sftp_get()${_remote_file} ${_local_file}"
fi
return 0
}
Many thanks in advance.
Regards
Abhishek Kumar