Some senseless babbling from William Mastop to All
on 07-26-97 14:38 about ftp in warp...
WM> I've been using os/2 warp 4, the ftp.exe program, to grab mail and
WM> files and such from hubs, with a script. I start it up as follows:
WM> === Begin ===
WM> ftp -i -n <"f:\fiftp\l920360
WM> The problem that I have is that if something hangs, like the net, a
WM> glitch with a file, what have you, it just sits there. It also doesn't
WM> let go of the comm port. I use ppp.exe to dial, and have it set to
WM> timeout if there's no activity. It does so just great, and then exits.
WM> Unfortuneately, it doesn't take ftp.exe with it. Any suggestions
WM> would be greatly appreciated. William
You could run a looping REXX script (with a delay, of course) that checks
for PPP.EXE in the process list, and if not found, kills any instances of
FTP.EXE that are running. You would need a process viewer/killer such as
GO.EXE for this.
It might work something like this:
----
/* Kill FTP if PPP exits */
call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
call SysLoadFuncs
exitsem='x:\path\ftpkillq.yes'
proclist='x:\path\process.lst'
do until stream(exitsem,'c','query exists')\=''
'@go > '||proclist
do until pppfound=1
info=linein(proclist)
if word(info,8)='PPP.EXE' then do
pppfound=1
ftpsearch=0
end
if translate(word(info,3))='UPTIME' then do
pppfound=1
ftpsearch=1
end
end
pppfound=0
call stream proclist,'c','close'
call SysFileDelete proclist
forcedexit=0
if ftpsearch=1 then do until ftpsgone=1
ftpkill=0
'@go >'||proclist
do until ftpfound=1
info=linein(proclist)
if word(info,8)='FTP.EXE' then do
ftpfound=1
pid=word(info,1)
ftpkill=1
end
if translate(word(info,3)='UPTIME' then do
ftpfound=1
ftpsgone=1
forcedexit=1
end
end
if ftpkill=1 then '@go -k '||pid
end
call stream proclist,'c','close'
call SysFileDelete proclist
if forcedexit=1 then exit
call SysSleep 300
end
call SysFileDelete exitsem
----
This would check the process list for PPP.EXE, and if found, sleep for 5
minutes, after which it checks again. If PPP.EXE is not found, it then
searches for FTP.EXE. If FTP.EXE isn't found, it exits promptly, because
there's no reason for it to be running. If it is found, it kills all
running FTP.EXE processes, then exits.
I just typed this into the message - it hasn't been tested at all. It
should point you in the right direction, though.
Just start this in a detached session before you start the FTP transfer.
It will die by itself after FTP finishes normally and exits, but you can
also make it quit by using the exit semaphore, should you have a reason.
Mike Ruskai [Team OS/2]
thanny@home.com
... After seeing Windows I realized Bill Gates is an idiot.
___ Blue Wave/QWK v2.20
--- RG 10-5 Exp/GE 1.02+
---------------
* Origin: The Licking Factory - OS/2 in NJ! (732) 815-3146 (1:107/634)
|