TIP: Click on subject to list as thread! ANSI
echo: os2rexx
to: Peter Knapper
from: Eddy Thilleman
date: 1999-09-26 21:02:06
subject: Concurrent sessions fail...

Hello Peter,

25 Sep 99 13:31, Peter Knapper wrote to All:

PK> I have an odd problem here folks, I have a REXX.CMD file that I invoke
PK> in 2 different sessions takinging 2 different sets of parameters, and
PK> while this works fine 90% of the time, sometimes one of the invoked
PK> sessions fails to start up and terminates early with NO output.

I might have a similar problem here, I see the same symptoms.

PK> Usually it is the FIRST session STARTed that fails to activate.

Here it's only the last session STARTed that executes, the previous ones seem
to have not executed.

I have one or more text files with files/websites to retrieve from internet
and I run a REXX script that reads the lines from that text file and for each
line it STARTs (with HSTART) a separate session with a wget to retrieve it (no 
REXX script in each session, just a command to wget).

To see if a short pause will fix it, I try it next time with "call SysSleep 1" 
following the START of each session.

Here is my REXX file:

------------------- begin of wgetmir.cmd -------------------
/* start wget mirroring each website listed in wget.mir */
arg InFile

if InFile = '' then
  InFile = 'wget.mir'

dir = directory( 'c:\www' )
'@set wgetrc=c:\www\wget.cfg'

cmd1 = 'wget.exe -m -c -np --tries=1 -k '
cmd2 = ' -a '
LogFile = "wget.mir.log"
filler = copies('-',30)

signal on notready

LineNr = 0

LineIn( InFile, 1, 0 )
  /* No read; opens inputfile */
  /* (if file is already open, sets the read position to the first line). */

do while Lines( InFile ) > 0
  LineNr = LineNr + 1
  Line = LineIn( InFile )
  say LineNr': 'Line
  LogFile = "wget.mir"LineNr".log"
  cmd = cmd1 || Line || cmd2 || LogFile
  written = LineOut( LogFile, filler date('W') date() Time() filler )
  "@start /win /c /b "cmd">nul"
  call SysSleep 1
end

exit

NotReady:
  if LineNr = 0 then
    say 'could not open 'InFile

exit
-------------------- end of wgetmir.cmd --------------------

.....later.....

I wondered why wget's output doesn't show up in the logfiles, so I started the 
sessions with /k instead of /c to see more, then I see errormessage:
"wet.mir1.log: Permission denied".

It turned out that the call to SysSleep apparently prevents wget from opening
the logfile.

I don't know why?

So I removed the call to SysSleep and (ofcourse changed /k back to /c) and now 
it works as it should.

PK> Does anyone have any idea of how I can remove the SLEEP and keep the
PK> 2 sessions reliably opening?

I don't know the answer.

  Greetings   -=Eddy=-        email: eddy.thilleman@net.hcc.nl

... C:\WINDOWS    C:\WINDOWS\GO    C:\PC\CRAWL
--- GoldED/2 3.0.1
* Origin: Windows98 is a graphic DOS extender (2:500/143.7)

SOURCE: echoes via The OS/2 BBS

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.