Script Abort when Passive address is unroutable

Advertisement

ngebhardt
Joined:
Posts:
2

Script Abort when Passive address is unroutable

Hello,
I'm running a script on Windows Server 2008R2 that calls WinSCP to download some files from a FTPS server that I do not control. If the remote server has been misconfigured (has happened a couple of times during this project) the script will hang on waiting for WINSCP because it keeps trying to reconnect to the server. WINSCP appears to try to reconnect indefinitely. This morning WINSCP tried for 45 minutes before the server was able to be fixed.

So my question is can I tell WINSCP to abort after the first time the passive connection fails so the script can move along? The log appears to show that WINSCP should be asking me if I want to retry and the batch option is set to abort so I thought I was good to go. Script and Log portion are below. WINSCP version 5.9.3 build 7136.

Thanks in advance.

#######
#Script:
#######

Option batch abort
open ftp://**user**:**pw**@**IP**:990 -implicit -certificate="**thumbprint**"
option confirm off

get /out/*.ach "C:\scripting\Transfer\"
mv /out/*.ach /archive/
close
exit

#######
#Log:
#######

2017-03-06 08:00:23.411 Script: Connecting to **IP**:990 ...
. 2017-03-06 08:00:23.411 Connecting to **IP**:990 ...
. 2017-03-06 08:00:23.473 Connected with **IP**:990, negotiating TLS connection...
. 2017-03-06 08:00:23.615 Verifying certificate for "**company**" with fingerprint **thumbprint** and 20 failures
. 2017-03-06 08:00:23.615 Certificate for "**company**" matches configured fingerprint
. 2017-03-06 08:00:23.616 Using TLSv1.2, cipher TLSv1/SSLv3: ECDHE-RSA-AES256-SHA384, 2048 bit RSA, ECDHE-RSA-AES256-SHA384 TLSv1.2 Kx=ECDH Au=RSA Enc=AES(256) Mac=SHA384
< 2017-03-06 08:00:23.616 Script: TLS connection established. Waiting for welcome message...
. 2017-03-06 08:00:23.616 TLS connection established. Waiting for welcome message...
< 2017-03-06 08:00:23.616 220 Microsoft FTP Service
> 2017-03-06 08:00:23.616 USER **user**
< 2017-03-06 08:00:23.692 331 Password required
> 2017-03-06 08:00:23.692 PASS ************
< 2017-03-06 08:00:23.759 230 User logged in.
> 2017-03-06 08:00:23.759 SYST
. 2017-03-06 08:00:23.818 The server is probably running Windows, assuming that directory listing timestamps are affected by DST.
< 2017-03-06 08:00:23.818 215 Windows_NT
> 2017-03-06 08:00:23.818 FEAT
< 2017-03-06 08:00:23.878 211-Extended features supported:
< 2017-03-06 08:00:23.878 LANG EN*
< 2017-03-06 08:00:23.878 UTF8
< 2017-03-06 08:00:23.878 AUTH TLS;TLS-C;SSL;TLS-P;
< 2017-03-06 08:00:23.878 PBSZ
< 2017-03-06 08:00:23.878 PROT C;P;
< 2017-03-06 08:00:23.878 CCC
< 2017-03-06 08:00:23.878 HOST
< 2017-03-06 08:00:23.878 SIZE
< 2017-03-06 08:00:23.878 MDTM
< 2017-03-06 08:00:23.878 REST STREAM
< 2017-03-06 08:00:23.879 211 END
> 2017-03-06 08:00:23.879 OPTS UTF8 ON
< 2017-03-06 08:00:23.938 200 OPTS UTF8 command successful - UTF8 encoding now ON.
> 2017-03-06 08:00:23.938 PBSZ 0
< 2017-03-06 08:00:23.997 200 PBSZ command successful.
> 2017-03-06 08:00:23.997 PROT P
< 2017-03-06 08:00:24.059 200 PROT command successful.
< 2017-03-06 08:00:24.059 Script: Connected
. 2017-03-06 08:00:24.059 Connected
. 2017-03-06 08:00:24.059 Doing startup conversation with host.
< 2017-03-06 08:00:24.060 Script: Starting the session...
> 2017-03-06 08:00:24.060 PWD
< 2017-03-06 08:00:24.119 257 "/" is current directory.
. 2017-03-06 08:00:24.119 Changing directory to "/".
> 2017-03-06 08:00:24.119 CWD /
< 2017-03-06 08:00:24.179 250 CWD command successful.
. 2017-03-06 08:00:24.179 Getting current directory name.
> 2017-03-06 08:00:24.179 PWD
< 2017-03-06 08:00:24.238 257 "/" is current directory.
. 2017-03-06 08:00:24.238 Startup conversation with host finished.
< 2017-03-06 08:00:24.238 Script: Session started.
. 2017-03-06 08:00:24.239 Retrieving directory listing...
> 2017-03-06 08:00:24.239 CWD /out/
< 2017-03-06 08:00:24.299 250 CWD command successful.
> 2017-03-06 08:00:24.299 PWD
< 2017-03-06 08:00:24.358 257 "/out" is current directory.
> 2017-03-06 08:00:24.358 TYPE A
< 2017-03-06 08:00:24.417 200 Type set to A.
> 2017-03-06 08:00:24.418 PASV
< 2017-03-06 08:00:24.477 227 Entering Passive Mode (10,2,201,50,237,144).
. 2017-03-06 08:00:24.477 Server sent passive reply with unroutable address 10.2.201.50, using host address instead.
> 2017-03-06 08:00:24.477 LIST
. 2017-03-06 08:00:24.477 Connecting to **IP**:60816 ...
< 2017-03-06 08:00:24.536 150 Opening ASCII mode data connection.
. 2017-03-06 08:00:39.633 Timeout detected. (data connection)
. 2017-03-06 08:00:39.633 Could not retrieve directory listing
. 2017-03-06 08:00:39.633 Connection was lost, asking what to do.
. 2017-03-06 08:00:39.633 Asking user:
. 2017-03-06 08:00:39.633 Lost connection. ("Server sent passive reply with unroutable address 10.2.201.50, using host address instead.","Timeout detected. (data connection)","Could not retrieve directory listing")
< 2017-03-06 08:00:39.633 Script: Lost connection.
< 2017-03-06 08:00:39.634 Script: Server sent passive reply with unroutable address 10.2.201.50, using host address instead.
< 2017-03-06 08:00:39.634 Timeout detected. (data connection)
< 2017-03-06 08:00:39.634 Could not retrieve directory listing

Reply with quote

Advertisement

ngebhardt
Joined:
Posts:
2

Re: Script Abort when Passive address is unroutable

martin wrote:

This issue is being tracked already:
https://winscp.net/tracker/1169

I'm sending you an email with a development version of WinSCP to the address you have used to register on this forum.

Thanks Martin! I'll give it a try if/when it breaks again and let you know. WinSCP is an awesome tool, thanks for your efforts.

Reply with quote

Advertisement

You can post new topics in this forum