/* Last Guru Log ** By Christopher 'WatchDog' Elliott $VER LastGuruLog.rexx 1.0 (23-Oct-01) Copyright © 2001 by WatchDog Distribution is only allowed withing Etienne Vogt's SysMon package as it doesn't work with any other package. History: 1.0 (23-Oct-01) o Initial release sent to author of SysMon package for inclusion. 0.3 o Clean up code, add headers and comments for release. 0.2 o Add QUIET argument to prevent output to console. 0.1 o Initial concept. Adds AlertDump output to SysMon log only if there is guru data available. */ OPTIONS RESULTS /* Parse command line argument if one exists. */ ARG inpt . Quiet=0 IF inpt ~= "" THEN IF (inpt="QUIET")|(inpt="Q") THEN Quiet=1 ELSE SIGNAL Usage /* Write AlertDump output to file in T: */ ADDRESS COMMAND 'C:AlertDump CLEAR >t:AlertDump.log' /* Verify that GURU data is available. Exit w/o writing to log if there is none. */ CALL Open(AlertTxt,'T:AlertDump.log','R') Check=ReadLn(AlertTxt) IF Check='No LastGuru data available' THEN DO CALL Close(AlertTxt) IF ~Quiet THEN SAY 'No GURU Information to log.' EXIT 0 END /* Write GURU data to log. */ CALL Seek(AlertTxt,0,'B') Line='The Following is the AlertDump output for the previous GURU' ADDRESS COMMAND 'C:SysLog "'||LINE||'" LEVEL 1 NOWIN' DO WHILE ~EOF(AlertTxt) Line=ReadLn(AlertTxt) ADDRESS COMMAND 'C:SysLog "'||LINE||'" LEVEL 1 NOHEAD NOWIN' END /* Clean up and report sucessful writing. */ CALL Close(AlertTxt) /*ADDRESS COMMAND 'C:beep'*/ IF ~Quiet THEN SAY "GURU information saved to SysMon's log file!" '07'X EXIT 0 Usage: SAY "RX LastGuruLog.rexx [Q=QUIET]" SAY " " SAY "Records the output of the SysMon support command AlertDump to the" SAY " SysMon log file. A copy of the AlertDump output is also stored in" SAY " the file T:AlertDump.log." SAY " " SAY "The QUIET switch prevents output from LastGuruLog.rexx to STDOUT." SAY " " SAY "Any invalid first argument shows this usage. Any argument after the" SAY " first argument is ignored." EXIT 0