Guest User

Untitled

a guest
Dec 15th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. sftp> ls
  2. sftp> put /tmp/testx
  3. Uploading /tmp/testx to /folder1/target_folder
  4. /tmp/testx 100% 5 0.0KB/s 00:01
  5. sftp> get testx
  6. Couldn't stat remote file: No such file or directory
  7. File "/folder1/target_folder/testx" not found.
  8. sftp> ls
  9. sftp>
  10.  
  11. debug3: SSH_FXP_REALPATH . -> /folder1
  12. debug3: Looking up /tmp/file_to_send
  13. debug3: Sent message sender_host 4 T:17 I:2
  14. debug3: Wrote 80 bytes for a total of 2653
  15. debug3: Received stat reply T:105 I:2
  16. debug3: Sent message SSH2_FXP_OPEN I:3 P:/folder1/target_directory/file_to_send
  17. debug3: Wrote 112 bytes for a total of 2765
  18. debug3: Sent message SSH2_FXP_WRITE I:4 O:0 S:6206
  19. debug3: Wrote 6288 bytes for a total of 9053
  20. debug3: SSH2_FXP_STATUS 0
  21.  
  22. drw-rw-rw- 1 0 0 target_directory
  23.  
  24. SSHPASS=${PASSWORD} sshpass -e sftp -vvv -oStrictHostKeyChecking=no -oBatchMode=no -b - ${LOGON}@${FTPSITE} >${LOB}ftp.log 2>&1 <<EOF
  25. pwd
  26. cd upload
  27. put ${XMTFILE}
  28. quit
  29. EOF
  30. # sftp does not use FTP codes - it only gives the final status of the requested operation
  31. Status=$?
  32. # Not perfect, but sending a single file using -vvv should produce 2 lines containing "debug3: SSH2_FXP_STATUS 0"
  33. Tmp=`grep "debug3: SSH2_FXP_STATUS 0" ${LOB}ftp.log | wc -l`
  34. [ ${Tmp} -ne 2 ] && Status=1 # Override sftp exit value based on log info
Add Comment
Please, Sign In to add comment