Re: Running FTP script and waiting for answer...can I set "timeout"

Tech-Archive recommends: Speed Up your PC by fixing your registry



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



.



Relevant Pages

  • Re: Running FTP script and waiting for answer...can I set "timeout"
    ... Did you have a chance to look at the FTP logs for further error messages. ... I can give you a copy of my script for you to scan... ... Set Fso = Wscript.Createobject ...
    (microsoft.public.scripting.vbscript)
  • Re: Running FTP script and waiting for answer...can I set "timeout"
    ... The next time ftp was trying to write to the file it sometimes ... after a change whish ensured the deletion of the file ftp nomore hangs. ... Also it is worth checking the ftp script file in c:\temp when the ftp ... Set Fso = Wscript.Createobject ...
    (microsoft.public.scripting.vbscript)
  • Re: Running FTP script and waiting for answer...can I set "timeout"
    ... I'm running ftp "run command" every 2 minuteto lookup new ... It's a two step action - first buliding thel scriptfile that takes down ... Set Fso = Wscript.Createobject ...
    (microsoft.public.scripting.vbscript)
  • Re: problem using FileSystemObject
    ... > When I came to the FileSystemObject I found IIS hangs on OpenTextFile. ... > I'm using the Script Debugger and executing one command at a time and it ... Set fso = Server.CreateObject ... > ' fails here ...
    (microsoft.public.inetserver.asp.general)
  • Re: Running FTP script and waiting for answer...can I set "timeout"
    ... Try this command to change default script engine to cscript from wscript ... I'm running ftp "run command" every 2 minuteto lookup new ... I can give you a copy of my script for you to scan... ... Set Fso = Wscript.Createobject ...
    (microsoft.public.scripting.vbscript)