/********************************************************************
* PROGRAM: CRASH1.CMD
* PURPOSE: Checks for e:\opus\flags\ACTIVE01.$$$ and reboots the
* system if it exists and the modem is off hook and if
* NoReboot.$$$ flag file is not present. NoReboot.$$$ is
* Created and removed from maintenance routines you run.
* FILES: Requires SIO and a CRON type scheduler (CRON93.ZIP I use)
* Also uses GREP to get users name as REXX won't look in
* open log file. These lines commented out. UNCOMMENT
* them if you have grep and want lastuser in log.
* USAGE: Run CRASH1.CMD from a scheduler as often as you like,
* I run it 2x an hour.
* WRITTEN: 7/30/96 by Jack Stein, 1:129/171
*
* **********************************************
* * NOTE: Search for LINES ENDING IN "..." and *
* * connect them with next line starting *
* * with "..." to make ONE line *
* * *
* * CORRECT PATHS FOR YOUR SYSTEM *
* **********************************************
*
********************************************************************/
if RxFuncQuery('SysLoadFuncs') then
do
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
/* load the Sys* utilities for SysSleep function*/
call SysLoadFuncs
end
/********************************************************************/
/******************** FIX PATHS for YOUR SYSTEM! ********************/
User_Flag = "e:\opus\Flags\Active01.dat"
Log_File = "e:\opus\Flags\Crash.Log"
NO_REBOOT = "e:\opus\flags\NoReboot.$$$"
OPUS_LOG = "e:\opus\opus.log"
SU_PATH = "c:\drivers\"
/********************************************************************/
Test_Count = 1
do i = 1 to 15
beep 350*i 1
end
call Check4_User
call Get_Out
/********************************************************************/
Check4_User:
if stream(No_Reboot,"C","QUERY EXISTS") \= "" then
do
rc = lineout(Log_File,"! " date() time() " No Check...
... - NoReboot exists")
rc = stream(Log_File,"C",Close)
exit
end
else if stream(User_Flag,"C","QUERY EXISTS") \= "" then...
... call Check_Modem
return
/*********************************************************************/
Check_Modem:
SU_PATH||'su 2 dcd >nul'
SU_Return_Code = rc
if SU_Return_Code = 0 then call Problem
return
/********************************************************************/
Problem:
if Test_Count = 1 then
do i = 75 to 1 by - 1
beep 50*i 1
end
say "BBS Apears to have Crashed"
say "press Ctrl-c to cancel reboot"
say "you have 120 seconds to Ctrl C and cancel action!!!"
Test_Count = Test_Count + 1
call syssleep(120)
if Test_Count = 2 then
do
/* Get last caller - Rexx won't open opened file so use grep */
/* UNCOMMENT these lines if you want last caller in log file*/
/***********************************************************
Target = '"Last caller"'
"grep " Target Opus_LOg '|Rxqueue'
/* step through all matches, keep last one */
do while queued() > 0
parse pull Last_Caller
end
************************************************************/
rc = lineout(Log_File,copies("*",70))
rc = lineout(Log_File, date('S') time())
rc = lineout(Log_File, "PROBLEM: BBS System Crash Detected!")
rc = lineout(Log_File, "Modem is Off Line and"...
... User_Flag "File is Present!!!")
rc = lineout(Log_File, time() "+++ System is rebooting now")
/*UNCOMMENT next line if you want last caller in log file*/
/* rc = lineout(Log_File, Last_Caller) */
rc = stream(Log_File,"C",Close)
reboot
end
call Check4_User
return
/*******************************************************************/
Get_Out:
exit
--- timEd/2-B11
---------------
* Origin: Jack's Free Lunch 4OS2 USR16.8 Pgh Pa (412)492-0822 (1:129/171)
|