home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 2 BBS
/
02-BBS.zip
/
ftpfid17.zip
/
MOVEFTP.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1996-09-08
|
5KB
|
173 lines
/* Moveftp.cmd */
'@echo off'
fidohold3 = 'f:\binkley\os2net.051\03d40000.hlo'
fidohold4 = 'f:\binkley\ibmnet.028\1112025c.hlo'
fidohold5 = 'f:\binkley\os2net.051\008c000f.hlo'
bbs_log = 'f:\bbs\logs\ftpmove.log'
esc = D2C(27)
ansi_red = esc || '[1;31m'
ansi_yellow = esc || '[1;33m'
ansi_normal = esc || '[0m'
IF Stream(fidohold3,'C', 'Query Exists') <>' ' Then
Do
moveto = 'f:\ftpmail\81.980.0\out'
holdfile = 'f:\binkley\os2net.051\03d40000.hlo'
fidobsy = 'f:\binkley\os2net.051\03d40000.bsy'
ihubusy = 'f:\ftpmail\81.980.0\*.bsy'
trial_count = 0
say ansi_yellow 'Moving mail for 81:980/0...' ansi_normal
call movelog date('N') Time('N') ' 81:980/0' 'Moving mail for 81:980/0 to 'moveto
call makebsy
end /* Do */
else say ansi_red 'Nothing to move!' ansi_normal
IF Stream(fidohold4,'C', 'Query Exists') <>' ' Then
Do
moveto = 'f:\ftpmail\81.140.15\out'
holdfile = 'f:\binkley\ibmnet.028\1112025c.hlo'
fidobsy = 'f:\binkley\ibmnet.028\1112025c.bsy'
ihubusy = 'f:\ftpmail\81.140.15\*.bsy'
trial_count = 0
say ansi_yellow 'Moving mail for 40:4370/604...' ansi_normal
call movelog date('N') Time('N') ' 40:4370/604' 'Moving mail for 40:4370/604 to 'moveto
call makebsy
end /* Do */
else say ansi_red 'Nothing to move!' ansi_normal
IF Stream(fidohold5,'C', 'Query Exists') <>' ' Then
Do
moveto = 'f:\ftpmail\81.140.15\out'
holdfile = 'f:\binkley\os2net.051\008c000f.hlo'
fidobsy = 'f:\binkley\os2net.051\008c000f.bsy'
ihubusy = 'f:\ftpmail\81.140.15\*.bsy'
trial_count = 0
say ansi_yellow 'Moving mail for 81:140/15...' ansi_normal
call movelog date('N') Time('N') ' 81:140/15' 'Moving mail for 81:140/15 to 'moveto
call makebsy
end /* Do */
else say ansi_red 'Nothing to move!' ansi_normal
/* Inbound */
IF Stream('f:\ftpmail\81.980.0\in\*.*','C', 'Query Exists') <>' ' Then
Do
New = Directory('f:\ftpmail\81.980.0\in')
'move *.* \binkley\inbound > nul: 2>&1'
end
IF Stream('f:\ftpmail\81.140.15\in\*.*','C', 'Query Exists') <>' ' Then
Do
New = Directory('f:\ftpmail\81.140.15\in')
'move *.* \binkley\inbound > nul: 2>&1'
end
exit
Makebsy:
IF Stream(ihubusy,'C', 'Query Exists') <>' ' Then
Do
say ansi_red 'Not this time!!!' ansi_normal
Return(0)
end
do until (trial_count > 3)
trial_count = trial_count + 1
if trial_count < 4
then
do
IF Stream(fidobsy,'C', 'Query Exists') <>' ' Then
Do
say ansi_red '!Node is busy - waiting.' ansi_normal
call SysSleep 60 /* sleep 60 seconds and wait */
end
else
do
'echo > 'fidobsy
trial_count = 4
Call movee
end
end
else
do
Say ansi_yellow 'Tired of waiting for busy flag...' ansi_normal
call movelog date('N') Time('N') ' Makebsy' 'Timed out waiting for busyflag!'
Return(0)
end
end /* Do until */
Return(0)
Movee:
New = Directory(moveto)
do until LINES(holdfile) = 0
line = LINEIN(holdfile)
if line > "" then do
Select
When Pos('^', line) = 1 then
Do
fullname = strip(line,l,'^')
IF Stream(fullname,'C', 'Query Exists') <>' ' Then
Do
'copy 'fullname
'del 'fullname
call movelog date('N') Time('N') 'Moving 'fullname
end
end
When Pos('#', line) = 1 & word(file.1,3) <> 0 then
Do
fullname = strip(line,l,'#')
IF Stream(fullname,'C', 'Query Exists') <>' ' Then
Do
call movelog date('N') Time('N') ' Copy/Trunc 'fullname
'copy 'fullname
rc=SysFileDelete(fullname)
IF rc <> 0 Then
do
say ansi_red '!Error del/truncating 'fullname ansi_normal
rc = lineout(logfile,'!Error del/truncating 'fullname
end
else do
rc = stream(fullname,'C','open write')
if rc <> 'READY:' Then
Do
say ansi_red '!Error recreating 'fullname ansi_normal
rc = lineout(logfile,'!Error recreating 'fullname)
end
call stream fullname, 'C', 'close'
end
end
end
otherwise
Do
IF Stream(line,'C', 'Query Exists') <>' ' Then
Do
call movelog date('N') Time('N') ' Copying 'line
'copy 'line
end
end
end /* Select */
end
end /* Do Until */
rc = stream(holdfile,'C','close')
'del 'holdfile '> nul: 2>&1'
'del 'fidobsy '> nul: 2>&1'
IF rc <> 0 Then
Do
say ansi_red '!Error deleting 'fidobsy ansi_normal
call movelog date('N') Time('N') ' Movee' '!Error deleting 'fidobsy
end
Return(0)
Movelog:
parse arg dt tm wh fr jb
call Lineout bbs_log ,dt tm wh fr jb
rc = stream(bbs_log,'c','close')
Return(0)