Topic "Connection failed when running automated script"

Author Message
merrowind
[View user's profile]

Joined: 2017-03-28
Posts: 3
Location: Denmark, Copenhagen
Hej there!

I have a batch script that calls for winscp.com with a script parameter, which is executed by a service account via scheduled task. The svc account can successfully execute the script interactively, but fails to establish connection to FTP servers when run in background.
A restart of the servers solves the matter for a couple of days and then it starts to fail.

Task:
Code:
C:\Program Files (x86)\WinSCP\WinSCP.com /script=C:\OrgUnitExport\FTPscript\sync.txt /log=C:\OrgUnitExport\RunSync\WinSCP.log /ini=nul


Script:
Code:
option batch abort
option confirm off
open ftp://USER:PASS@10.40.140.111
synchronize local C:\OrgUnitExport\ /CA_OrgData
synchronize local C:\OrgUnitExport\ /CA_UserData
exit


WinSCP log:
Code:
. 2017-03-28 18:36:09.518 --------------------------------------------------------------------------
. 2017-03-28 18:36:09.518 WinSCP Version 5.7.2 (Build 5316) (OS 6.3.9600 - Windows Server 2012 R2 Standard)
. 2017-03-28 18:36:09.518 Configuration: nul
. 2017-03-28 18:36:09.518 Log level: Normal
. 2017-03-28 18:36:09.518 Local account: DOMAIN\SVC
. 2017-03-28 18:36:09.518 Working directory: C:\OrgUnitExport\RunSync
. 2017-03-28 18:36:09.518 Process ID: 3428
. 2017-03-28 18:36:09.518 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console=572 /consoleinstance=_18192_197 "/script=C:\OrgUnitExport\FTPscript\sync.txt" "/log=C:\OrgUnitExport\RunSync\WinSCP.log" "/ini=nul"
. 2017-03-28 18:36:09.518 Time zone: Current: GMT+2, Standard: GMT+1 (Romance Standard Time), DST: GMT+2 (Romance Daylight Time), DST Start: 26-03-2017, DST End: 29-10-2017
. 2017-03-28 18:36:09.518 Login time: 28. marts 2017 18:36:09
. 2017-03-28 18:36:09.518 --------------------------------------------------------------------------
. 2017-03-28 18:36:09.518 Script: Retrospectively logging previous script records:
> 2017-03-28 18:36:09.518 Script: option batch abort
< 2017-03-28 18:36:09.518 Script: batch           abort     
< 2017-03-28 18:36:09.518 Script: reconnecttime   120       
> 2017-03-28 18:36:09.518 Script: option confirm off
< 2017-03-28 18:36:09.518 Script: confirm         off       
> 2017-03-28 18:36:09.518 Script: open ftp://USER:***@10.40.140.111
. 2017-03-28 18:36:09.518 --------------------------------------------------------------------------
. 2017-03-28 18:36:09.518 Session name: USER@10.40.140.111 (Ad-Hoc site)
. 2017-03-28 18:36:09.518 Host name: 10.40.140.111 (Port: 21)
. 2017-03-28 18:36:09.518 User name: USER (Password: Yes, Key file: No)
. 2017-03-28 18:36:09.518 Transfer Protocol: FTP
. 2017-03-28 18:36:09.518 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2017-03-28 18:36:09.518 Disable Nagle: No
. 2017-03-28 18:36:09.518 Proxy: none
. 2017-03-28 18:36:09.518 Send buffer: 262144
. 2017-03-28 18:36:09.518 UTF: 2
. 2017-03-28 18:36:09.518 FTP: FTPS: None; Passive: Yes [Force IP: A]; MLSD: A [List all: A]
. 2017-03-28 18:36:09.518 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2017-03-28 18:36:09.518 Cache directory changes: Yes, Permanent: Yes
. 2017-03-28 18:36:09.518 Timezone offset: 0h 0m
. 2017-03-28 18:36:09.518 --------------------------------------------------------------------------
. 2017-03-28 18:36:09.518 Connection failed.


Running interactively under svc user or any other the WinSCP log looks the same, but the connection is established. I have to note, that the application owner has told me that such an issue is *come and go* even when it was running on w2k8 r2. Any assistance would be appreciated.
Advertisements
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26730
Location: Prague, Czechia
Did you try if the service account can establish connection to the FTP server using any other client, at the moment it fails with WinSCP?
_________________
Martin Prikryl
merrowind
[View user's profile]

Joined: 2017-03-28
Posts: 3
Location: Denmark, Copenhagen
No other client with CLI was tested. I can only say that when the connection starts to fail via scheduled task, it still works fine if ran interactively under the service account.
The application server has just been restarted, so it will take several days for it to start failing again, so I cannot reproduce the issue atm.
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26730
Location: Prague, Czechia
merrowind wrote:
No other client with CLI was tested. I can only say that when the connection starts to fail via scheduled task, it still works fine if ran interactively under the service account.
The application server has just been restarted, so it will take several days for it to start failing again, so I cannot reproduce the issue atm.

What you describe are symptoms of this bug:
https://winscp.net/tracker/show_bug.cgi?id=996
But it has been fixed long time ago.
Any chance your have another task that uses an old version of WinSCP?
merrowind
[View user's profile]

Joined: 2017-03-28
Posts: 3
Location: Denmark, Copenhagen
I thought so too, but I checked all around and the only used WinSCP instance is the default installation path.
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26730
Location: Prague, Czechia
Did you check in Task Manager that there are no pending WinSCP process left behind?
Advertisements

You can post new topics in this forum

Search

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License