Topic "if statement for "Connection refused""

Author Message
Whykonen

Guest


Hello, i want to sent an error e-mail only when connection is refused. How do i catch this, is there a error level or code to catch it?

If a file fails transferring, i don't want to send an e-mail.

It seems errorcode 1 is wider then what i want.

batch:
Code:

:nietwinxp
echo nietwinxp
winscp.com /script=buo-nietwinxp.txt
if errorlevel 1 goto error
goto end


log of connection refused:
Code:

. 2011-01-31 14:43:51.468 Looking up host "backuponline.webboy.nl"
. 2011-01-31 14:43:51.473 Connecting to 195.241.102.8 port 22
. 2011-01-31 14:43:53.581 Server unexpectedly closed network connection
* 2011-01-31 14:43:53.585 (ESshFatal) Server verbrak onverwacht de netwerkverbinding.
whykonen

Guest


anyone??

I want to detect if the IP has changed, because i use a access list. Thats what i'm trying to filter out with an errorlevel, to send mail. But errorlevel 1 seems to wide.

please help!
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
There's no simple solution. But you can use XML logging. If it contains just empty <session/> tag (like below) and exit code is 1, it is likely that the connection has failed for some reason.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<session xmlns="http://winscp.net/schema/session/1.0" name="my session" start="2011-02-02T07:17:47.632Z">
</session>

_________________
Martin Prikryl
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