Re: Running FTP script and waiting for answer...can I set "timeout"
- From: "Babu VT" <babuvt@xxxxxxxxxxxxx>
- Date: Wed, 26 Jul 2006 15:23:21 +0530
Hi Leon,
Try this command to change default script engine to cscript from wscript
cscript //H:Cscript //nonlogo //s
rgds
Babu
"Leon" <kim.zethsen@xxxxxxxxx> wrote in message
news:1153864632.999430.195370@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Babu VT wrote:
Hi,
Can you post the code snippet to have a look.
rgds
Babu
"Leon" <kim.zethsen@xxxxxxxxx> wrote in message
news:1153778811.779051.273710@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi
I'm running ftp "run command" every 2 minute(scheduler) to lookup new
files and download them.
It's a two step action - first buliding thel scriptfile that takes down
a filelist.
Iterating through this I find out if a new file is on the list.
Building a new scriptfile from this list with "get" command on new
files.
That works perfect .. exept for "some times" where no answer is comming
from the FTP site.
If I just waits for the answer I dont' get it and everything "hangs"
for days.
The task is scheduled by windows scheduler every 2 minute.
It is stopped if it still runs after 1 minute (because FTP not
responding some times)
This trick works for "terminating" the hanging ftp proces and normally
I'm lucky with my connection 2 minutes after again! so the problem is
not the LAN connection to the internet.
I did first run with option waitforresult=TRUE
(wshell.run "ftp -i -s:"&file_script, 0, False) and was waiting for
days some times. When "restarting" the scheduler everything ran under 3
seconds - perfect - it hangs and I don't know why.
Stop (scheduler) after 1 minutes helps me - but - Is there a "prefered"
- -"right" way to do thid task?
I'm very interested in a sample
I can give you a copy of my script for you to scan...
Cheers
'**********************************************************************
'* Create ftp scriptfile in "c:\temp"
'* to make a total fillist in "c:\temp"
'**********************************************************************
WriteLog("Creating Scriptfile...")
Set Fso = Wscript.Createobject("Scripting.FilesystemObject")
Set cmds = Fso.CreateTextFile(fil_script, True)
cmds.writeline "open "&ftp_server
cmds.writeline ftp_logon_navn
cmds.writeline ftp_password
' cmds.writeline "lcd "&ftp_tmp_mappe
cmds.writeline "ls "&ftp_filnavn&" "&fil_liste_total
cmds.writeline "bye"
cmds.close
set cmds = nothing
set Fso = nothing
tjekerror
WriteLog("Scriptfile created!")
'**********************************************************************
'* Make a fillist in "c:\temp"
'**********************************************************************
Set WshShell = Wscript.createObject("Wscript.Shell")
WriteLog("Logging on ftp-server and makes fillist...")
'WshShell.Run "ftp -i -s:"&fil_script
' here I set waitonreturn to false
WshShell.Run "ftp -i -s:"&fil_script ,0,False
'and waits 3 seconds - normally enough
Wscript.Sleep 3000
Set WshShell = Nothing
WriteLog("Logged off ftp-server!")
tjekerror
'**********************************************************************
'* check that filelist in "c:temp" exists
'**********************************************************************
Set Fso = Wscript.Createobject("Scripting.FilesystemObject")
If Not Fso.FileExists(fil_liste_total) then
Set Fso = Nothing
Writelog("ERROR! Could not find "& fil_liste_total & ",
terminating
script")
call close
else
Writelog(fil_liste_total & " created!")
end if
Set Fso = Nothing
tjekerror
.
- Follow-Ups:
- References:
- Prev by Date: joining domain and workgroup
- Next by Date: recordset query in vbscript
- Previous by thread: Re: Running FTP script and waiting for answer...can I set "timeout"
- Next by thread: Re: Running FTP script and waiting for answer...can I set "timeout"
- Index(es):
Relevant Pages
|