LOGCHECK -- Checks log files for strings Alton Moore which signify good or failed Fidonet 1:397/5264 (NEC) net connections in batch. WWIVnet 1@1042 Version 1.0, 08/16/1992 --------------------------------------------------------------------------- INTRODUCTION: ------------- This program is intended to determine whether a network transfer occurred (say at least once per night) by scanning a network log file for a specified string. The addition to the log of text containing this string causes the program to exit with a certain error level, which you may use in your batch files to determine whether the network transfer just attempted was successful. Although this program is not network-specific in any way, I will generally give examples for a FrontDoor/WWIV setup. THEORY OF OPERATION: -------------------- The program will perform 2 functions: marking the current size of a given log file and checking that file for the addition of text containing a target string (say "connected"). These functions are meant to be used before and after a network transfer attempt to determine whether the attempt was successful. These functions, in conjunction with a flag file, can be used to ensure that, for example, your system calls another system at least once per night. The first step would be to create a flag file (probably in batch) as soon as you want your system to start trying to call the target system. You would create an event which created your flag file: . . echo This file's presence causes my FrontDoor batch file to do a WWIV callout! >\bbs-util\wwiv1040.flg <--- continuation of previous line . . Then, at some point in your batch file which is often traveled by your system, for example just after every net connection or human caller, you might put: . . if exist \bbs-util\wwiv1040.flg goto wwiv_callout . . And then, the actual callout code: :wwiv_callout cd \wwiv \wwiv\utility\logcheck -m \wwiv\gfiles\netdat0.log \wwiv\utility\clout.exe 1040 1 \wwiv\utility\logcheck -p 5 \wwiv\utility\logcheck -s connected if errorlevel 1 goto run_frontdoor del \bbs-util\wwiv1040.flg goto run_frontdoor Note that above, in the first invocation of the program, -m is used as the first argument to indicate storing the name of the file we're referring to (supplied as the second argument) as the first line of the holding file logcheck.dat and the current size as the second line. The -p invocation prints out the addition to the log file to the screen, pausing for 5 seconds to let you get a gander at the results! The next invocation (scan, indicated by -s) scans the file stored as the first line of logcheck.dat, starting at the byte indicated by the second line of logcheck.dat. The second argument is the string to scan for (use quotes to encapsulate strings with odd characters or spaces). If the string is found, then error code 0 is returned; if not, then 1 is. SYNTAX: ------- Run the program with no arguments for the latest help information. The functions supported by the program are: -m [logfilespec] remembers the filespec of the log file and the current size and stores them. -s [stringtoscanfor] returns 0 if this string was found to be added to the file since the last mark operation. -p [delaytime] prints the new part of the log to the screen, pausing for [delaytime] afterwards. The error codes returned by the program are: -m function: 0 = successful 2 = bad parameter (function or filename) -s function: 0 = successful (string found in new part of log file), 1 = unsuccessful (log file same size or smaller or string not found in new part of log file) 2 = bad parameter (function or filename) -p function: Oh, just look at the source.... --------------------------------------------------------------------------- Well, if you are totally confused by now, I don't blame you. Drop me a line (at either address listed above) explaining your situation and I'll try to help. Alton Moore