/* Samba Server for eComStation (OS/2) tools Version 1.2.1 (c) 2013 Herwig Bauernfeind for bww bitwise works GmbH. Script: ChkTDB.CMD, requires REXX and tdbtool.exe from Samba 3.3 or better. Purpose: Test the integrity of all TDB files in the current diectory. In case a TDB file fails the integrity check the resulting logfile is preserved and carries a name of xxx.tdb.err Syntax: No parameters. */ call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs' call SysLoadFuncs ok = SysFileTree("*.TDB",tdb.,'FO') error = 0 do I = 1 to tdb.0 call charout , left(filespec('N',tdb.I), 22) address cmd '@tdbtool 'tdb.I' check 2>'tdb.I'.err 1>'tdb.I'.out' out = linein(tdb.I'.out') ok = stream(tdb.I'.out','c','close') say out if pos('integrity is OK',out) = 0 then do call beep 880, 20 address cmd '@tdbbackup -s.bak -v 'tdb.I' 2>NUL 1>NUL' error = 1 do while lines(tdb.I'.err') > 0 errline = linein(tdb.I'.err') select /* skip unnecessary lines of log */ when pos("bww ",errline) > 0 then iterate when pos("fcntl",errline) > 0 then iterate otherwise say copies(' ',22)'Cause: 'errline'!' end end ok = stream(tdb.I'.err','c','close') end else do ok = SysFileDelete(tdb.I'.err') ok = SysFileDelete(tdb.I'.out') address cmd '@tdbbackup -s.bak 'tdb.I' 2>NUL 1>NUL' end end