home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 2 BBS
/
02-BBS.zip
/
ftpfid17.zip
/
HANGUP.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1996-09-14
|
4KB
|
157 lines
/* Hangup.cmd */
parse arg ftproc
'@echo off'
hangupflg = 'f:\bbs\logs\hangup.flg' /* Tells CSPPP to hangup */
ftpflg = 'f:\bbs\logs\Doing_ftp.flg' /* FTPFIDO process flag */
hisbsy = 'f:\binkley\outbound\018c0001.bsy'
ftpin = 'd:\ftpin\*.*'
tcpbin = 'd:\tcpip\bin'
/* Set to 1 and it becomes a watchdog for FTPFIDO w/o terminating PPP */
WatchDog = 0
/* Do you have Bink/Max up on the Net? If watchdog = 1 set this to 0 */
binkup = 0
if binkup = 1 then
do
binkflg = 'f:\bbs\binkley\flags\task.03'
maxflg = 'f:\bbs\max\system\active03.bbs'
end
/* End Globals */
b = 0
d = 0
abort = 0
thischeck = 0
lastcheck = 0
thistime = 0
lastime = 0
thistimek = 0
lastimek = 0
elapsed = time('e')
do forever
Select
When Stream(ftpflg,'C', 'Query Exists') <>' ' Then
Do
rc = SysFileTree(ftpin,files.,"F")
if b = 0 then thischeck = files.0 /* First check */
if b = 4 then /* 4 = 10 min. */
do
lastcheck = files.0
if thischeck = lastcheck then
do
call bbslog "hangup", "Killed FtpFido, no files received"
'go -k 'ftproc /* process killer. ftproc is the PID */
abort = 1
signal Ttyl
end
end
if files.0 > 0 then
do
if b = 18 | b = 0 then
do
thistime = files.0
if thistime = lastime then
do
call bbslog "hangup", "Killed FtpFido, hung session"
'go -k 'ftproc /* process killer. ftproc is the PID */
abort = 1
signal Ttyl
end
else b = 0
lastime = thistime
end
end
say 'Must be doing mail....waiting 2.5 mins.'
Call SysSleep 150
b = b + 1
end
/* When Stream(ihubflg,'C', 'Query Exists') <>' ' Then
* Do
* rc = SysFileTree(kevout,files.,"F")
* if c > 2 then
* do
* abort = 1
* signal Ttyl
* end
* if files.0 > 0 then
* do
* if d > 7 | d = 0 then
* do
* thistime = files.0
* if thistimek = lastimek then
* do
* abort = 1
* signal Ttyl
* end
* else d = 0
* lastimek = thistimek
* end
* end
* else c = c + 1
* say 'Kevin must be doing mail....waiting.'
* Call SysSleep 300
* b = b + 1
* d = d + 1
* end
*/
When binkup = 1 & Stream(maxflg,'C', 'Query Exists') <>' ' Then
Do
elapsed = time('e')
if elapsed > 3600 then signal Ttyl
say 'Someones on the BBS....waiting 5 mins.'
Call SysSleep 300
b = b + 1
end
When binkup = 1 & Stream(binkflg,'C', 'Query Exists') <>' ' Then
Do
elapsed = time('e')
if elapsed > 3600 then signal Ttyl
say 'Someones on the mailer....waiting 5 mins.'
Call SysSleep 300
b = b + 1
end
Otherwise
do
signal ttyl
end
end /* Select */
end /* Do Forever */
Ttyl:
if abort = 1 then
do
/* del 'f:\binkley\kevin\ihub.bsy > nul: 2>&1' */
del ftpflg' > nul: 2>&1'
del hisbsy' > nul: 2>&1'
end
if watchdog = 0 then
do
say '
!Doing the Hangup thing...
'
rc = stream(hangupflg,'C','open write') /* Set hangup flag */
if rc <> 'READY:' Then
say '!Error creating hangup flagfile.'
rc = stream(hangupflg,'C','close')
New=Directory(tcpbin)
'pppkill > nul: 2>&1'
if binkup = 1 then
do
'echo > f:\bbs\binkley\flags\btexit01.03'
'killem vmodem.exe > nul: 2>&1'
end
/* New=Directory('d:\tcpip\penftpd') */
/* 'penftpd -q' */
end
exit