0

I'm trying to figure out and I would like to know if some of you experienced this before.

I have my SFTP script (before it was FTP, and was migrated to SFTP), when I'm sending a file to the client server I'm getting a message in the verbus "No such file or directory" but the file is on the client server. this didn't happen before when I had FTP connection.

any of you have experienced this before? even I'm exiting with status 0 that is very weird for me...

debug1: Couldn't stat remote file: No such file or directory
debug1: Couldn't stat remote file: No such file or directory
debug1: channel 0: read<=0 rfd 6 len 0
debug1: channel 0: read failed
debug1: channel 0: close_read
debug1: channel 0: input open -> drain
debug1: channel 0: ibuf empty
debug1: channel 0: send eof
debug1: channel 0: input drain -> closed
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: rcvd close
debug1: channel 0: output open -> drain
debug1: channel 0: obuf empty
debug1: channel 0: close_write
debug1: channel 0: output drain -> closed
debug1: channel 0: almost dead
debug1: channel 0: gc: notify user
debug1: channel 0: gc: user detached
debug1: channel 0: send close
debug1: channel 0: is dead
debug1: channel 0: garbage collecting
debug1: channel_free: channel 0: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 2 clearing O_NONBLOCK
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 4.6 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
debug1: Exit status 0

Code:

sure, I have this:

 sftp -v -b ${sftp_file} ${username}@${server} > ${tmplog1} 2>&1 > ${tmplog2}
 GetStatus=$?
 if (( $GetStatus != 0 )); then
    if [[ $(grep -c "No such file or directory" ${tmplog1}) > 0 ]]; then
        ErrorMessage="No such file or directory"
    elif [[ $(grep -c "Connection refused" ${tmplog1}) > 0 ]]; then
        ErrorMessage="Connection refused with the server"
    elif [[ $(grep -c "Connection timed out" ${tmplog1}) > 0 ]]; then 
        ErrorMessage="Connection timed out with the server"
    elif [[ $(grep -c "No route to host" ${tmplog1}) > 0 ]]; then
         ErrorMessage="No route to the server."
    else
        ErrorMessage="Unknown Error in transmission  process."
    fi
 fi

Thanks!

  • Can you post the script? When you say the 'file is on the client server', did you check the destination server and see the transferred file? You have Exit status 0, but if you check the previous 2 lines, you will see no data was actually transferred. – MikeA Sep 27 '16 at 23:07
  • I added a piece of code, when I say "file is on the client server" I mean the file was transferred to the other server, but for some reason "No such file or directory" is displayed and it ends with exit status 0, this didn't happen before with FTP, we had to migrate to SFTP. and it started to throw that message. – Javier Salas Sep 28 '16 at 14:53
  • Possibly related: http://unix.stackexchange.com/q/131766/22565 – Stéphane Chazelas Sep 28 '16 at 14:58

0 Answers0