Topic "Timeout waiting for external console to complete the command"

Author Message
filipd
[View user's profile]

Joined: 2016-01-13
Posts: 5
Hello

I have a PS script (using WinSCP .NET assembly) to synchronize a directory between Windows (target) and Linux (source).
Most of the time, the script fails with the following error message :

2016-01-17 23:27:08.238 Type: SSH_FXP_CLOSE, Size: 13, Number: 236635908
* 2016-01-17 23:27:08.613 (ECommand) **Copying files from remote side failed.**
* 2016-01-17 23:27:08.613 Timeout waiting for external console to complete the command.
< 2016-01-17 23:27:08.613 Script: Copying files from remote side failed.
< 2016-01-17 23:27:08.676 Script: Timeout waiting for external console to complete the command.
. 2016-01-17 23:27:08.769 Script: Failed
> 2016-01-17 23:27:19.551 Script: exit
. 2016-01-17 23:27:19.566 Script: Exit code: 1
. 2016-01-17 23:27:19.566 Closing connection.
. 2016-01-17 23:27:19.629 Sending special code: 12
. 2016-01-17 23:27:19.629 Sent EOF message


The logfile can be found in attachment.
Thanks for helping me out

Filip
copy.zip (866.37 KB) Private file

Description: file compressed using 7-zip

Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
Can you please try the latest version first?
filipd
[View user's profile]

Joined: 2016-01-13
Posts: 5
ok, we'll do.
I'll keep you informed (job only runs during the night)
filipd
[View user's profile]

Joined: 2016-01-13
Posts: 5
Hello

Job failed again last night.
New log to be found in attachment.

Br

Filip
copy20160119.log (892.64 KB) Private file

Description: (none)

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
Why do you have the timeout set to 0? That does not make any sense.
filipd
[View user's profile]

Joined: 2016-01-13
Posts: 5
Timeout set to 0 ?
I've lost you there : the code looks as follows :

try
{
# Load WinSCP .NET assembly
Add-Type -Path "C:\Program Files (x86)\WINSCP\WinSCPnet.dll"

# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::Sftp
$sessionOptions.HostName = "XXXXXXX"
$sessionOptions.UserName = "XXXXXXX"
$sessionOptions.Password = "XXXXXXX"
$sessionOptions.Timeout = 300
$sessionOptions.SshHostKeyFingerprint = "ssh-rsa XXXXXX"


$session = New-Object WinSCP.Session

try
{
# Connect
$session.ExecutablePath = "C:\Program Files (x86)\WINSCP\winscp.exe"
$Session.SessionLogPath = "C:\Scripts\copy.log"
# $Session.DebugLogPath = "C:\Scripts\copydebug.log"
$session.Open($sessionOptions)

# Synchronize files
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.TransferMode = [WinSCP.TransferMode]::Binary
$transferOptions.SpeedLimit = 6000

$transferResult_Data = $session.SynchronizeDirectories([WinSCP.SynchronizationMode]::Local, "E:\PRD_BACKUPS\DATA\", "/hana/hana-backup/PRD/data/",$true,$false,[WinSCP.SynchronizationCriteria]::Time,$transferOptions)
$transferResult_Data.Check()
$transferResult_Logs = $session.SynchronizeDirectories([WinSCP.SynchronizationMode]::Local, "E:\PRD_BACKUPS\LOGS\", "/hana/hana-backup/PRD/log/",$true,$false,[WinSCP.SynchronizationCriteria]::Time,$transferOptions)
$transferResult_Logs.Check()


}
finally
{
# Disconnect, clean up
$session.Dispose()
}
Send-MailMessage -From "hostname" -To "XXXXXXXXX" -Subject "synchronization of backupfiles (DATA & LOGS) from <hostname> to <hostname> finished OK" -SmtpServer "yyy"
exit 0
}
catch [Exception]
{
$ErrorMessage = $_.Exception.Message
Send-MailMessage -From "hostname" -To "XXXXXXXXX" -Subject "synchronization of backupfiles (DATA or LOGS) from <hostname> to <hostname> FAILED !" -SmtpServer "yyy" -Body "Error message is $ErrorMessage"
exit 1
}
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
The SessionOptions.Timeout is of type TimeSpan.

The 300 gets converted by PowerShell to TimeSpan 00:00:00.0000300 what rounds to zero later.
filipd
[View user's profile]

Joined: 2016-01-13
Posts: 5
thanks, my mistake.
I'll adjust this timeout parameter and try the job again
Advertisements

You can post new topics in this forum






Search Site

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