jdn717
asked on
WS_FTP Script "Connect Failure" Handling
Whats an appropriate way of handling a connection failure in ws_ftp script? I have a job that runs nightly and Im not sure what to do below. My manager just gave me this task and Im not familiar with the keywords.
This is the code in the .scp file that is passed into the ftpscrpt application via a .bat file. The connection failure takes places at line 3, of course :) How should I handle this issue? Increase the timeout? A loop?
This is the code in the .scp file that is passed into the ftpscrpt application via a .bat file. The connection failure takes places at line 3, of course :) How should I handle this issue? Increase the timeout? A loop?
LOG E:\BatchProcesses\ReceivedFiles\RiskImport\RiskImportXML.log
TRACE Screen
CONNECT TBI!RiskImport
ONERROR GOTO DISCONNECT
MGET *.pgp E:\BatchProcesses\ReceivedFiles\RiskImport\Files\
LABEL FILEDELETE
MDELETE *.PGP
LABEL DISCONNECT
CLOSE
ASKER
Heres the log. It usually connects just fine. Would you mind explaining that PING solution you mentioned. That sounds interesting.
E:\BatchProcesses\ReceivedFiles\RiskImport>ECHO OFF
Processing Line 1 [LOG E:\BatchProcesses\ReceivedFiles\RiskImport\RiskImportXML.log] Processing Line 2 [TRACE Screen]
Processing Line 3 [CONNECT TBI!RiskImport] Finding Host ftp.tnwinc.com ... [2012.07.06 03:00:15.662] Connecting to 67.202.192.115:21 [2012.07.06 03:00:16.834] Connect failure Failure in command [CONNECT TBI!RiskImport]
Processing Line 4 [ONERROR GOTO DISCONNECT] Set [ONERROR] action to [GOTO DISCONNECT] Processing Line 5 [MGET *.pgp E:\BatchProcesses\ReceivedFiles\RiskImport\Files\] Not Connected Failure in command [MGET *.pgp E:\BatchProcesses\ReceivedFiles\RiskImport\Files\]
Processing command [ONERROR GOTO DISCONNECT] at line 4
Processing Line 4 [GOTO DISCONNECT] Jump to command [LABEL DISCONNECT] at line 8 Set [ONERROR] action to [CONTINUE ]
Processing Line 8 [LABEL DISCONNECT] Processing Line 9 [CLOSE]
ASKER
This is the first part of the bat.
ECHO OFF
REM Risk Upload XML Download
rem Upload the File
cd c:\Program Files (x86)\Ipswitch\WS_FTP 12\
"c:\Program Files (x86)\Ipswitch\WS_FTP 12\ftpscrpt" -f E:\BatchProcesses\ReceivedFiles\RiskImport\RiskUploadXML.scp
if errorlevel 1 goto :Error
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Also, you will want to change the 6000 to 60000 in the second PING which is just used as a delay technique. I had lowered it to 6 seconded during some testing here.
~bp
~bp
ASKER
Yeah, I think this is going to work. I tested it and I am getting satisfactory results. My fortay isnt script so I appreciate the help.
Welcome, hope that works out for you. Thanks for the feedback.
~bp
~bp
If it's the case that the server can be down sometimes when the script runs, you could add a PING in the BAT script before the WSFTP execution, and let it loop until the server responds to a PING.
~bp