FIND or FINDSTR should work equally well, I think. Maybe it depends on your exact platform.
-----Original Message----- Sent: Tuesday, July 01, 2003 5:07 PM To: Multiple recipients of list ORACLE-L Hi... I could not follow this thread, so, I do not know the current status... anyway... I tested this and it works... 1.- First, I saw that you asked for: string called ORA and your errorlevel statement failed. 2.- Second, the script sent by: Seefelt, Beth looks like it works (I did not test it), EXCEPT that you HAVE to change this line: > FIND "ORA-03313" psprcsrv_psnt_%MMDD%.log with this one: > FINDSTR "ORA-03313" psprcsrv_psnt_%MMDD%.log HTH JL there you go... (modify at your own needs...) copy con test.cmd findstr "%1" alert_develop.log if errorlevel 1 goto no if errorlevel 0 goto si :no echo no se encontr≤ la cadena: %1 goto fin :si echo si se encontr≤ la cadena: %1 :fin ctrl-Z --- "Seefelt, Beth" <[EMAIL PROTECTED]> wrote: > > That actually makes it alot easier > > FOR /F "tokens=1-5 delims=/, " %%i in ('date/t') DO > SET MMDD=%%j%%k > if NOT EXIST psprcsrv_psnt_%MMDD%.log goto no_file > FIND "ORA-03313" psprcsrv_psnt_%MMDD%.log > if errorlevel 1 ( echo 'there is a match' > d:\start_proc.bat ) > goto :EOF > > :no_file > echo Can't find todays log! > exit /b 2 > > > > -----Original Message----- > Sent: Tuesday, July 01, 2003 3:51 PM > To: Multiple recipients of list ORACLE-L > > > Bob, > > I tested it out, it works on one hard code file. If > I set thisfile it > works. But in reality, I need to find today's log, > the log file name > convention is always goes psprcsrv_psnt_0701.log > with the date suffix to > the end. I can't hard code the file name in the bat > file. Is there > anyway how to get around with this? > > Thanks, > > Joan > > Bob Metelsky wrote: > > > > Don't run it line by line > > Save it to a file called myfind.bat > > > > Then call from a command prompt > > > > C:\> myfind.bat > > > > Or click the batch file, be sure to leave the > pause so you can see an > > error if any. Once its working, you can then > implemet blat as someone > > suggested > > > > Here is a version using variables > > > > > ########################################################## > > > > [myfind.bat] > > :: Find example by BMetelsky on > Friday-April-11-2003-9:22:53 AM > > :: This script searches thefile for a string and > if it finds it, sends > > an email message to dbamail > > :: 0 =is found > > echo off > > set themess=A Database SERVICE on %computername% > is NOT running on > > %date% at %time% > > set [EMAIL PROTECTED] > > set blatfile=D:\dbmon\blattext.txt > > set thefile=D:\dbmon\runit.log > > set subject=A DB SERVICE IS NOT RUNNING > > set [EMAIL PROTECTED] > > echo starting >%blatfile% > > > > find "ERROR:" %thefile% >NUL > > > > IF ERRORLEVEL 1 GOTO no > > IF NOT ERRORLEVEL 1 GOTO yes > > :no > > goto end > > > > :yes > > echo A db service is down on > %computername%>%blatfile% > > blat D:\dbmon\blattext.txt -subject "%subject%" > -to "%dbamail%" -i > > "%from%" -body "%themess%" > > goto end > > > > :end > > @exit > > rem echo %errorlevel% > > > > > ########################################################## > > > > > Hi Bob, thanks for the reply. I added your code > and tested > > > still no good. I tested the case without a > match. Still go to run. > > > > > > Joan > > > > > > D:\oracle\admin>FORFILES > > > -pd:\pslogs_psfm\fmdev8\_psprcsrvlog\ -s -m*.log > -d+0 -c"CMD > > > /c echo @FILE" PSPRCSRV_PSNT_0630.log > PSPRCSRV_PSNT_0701.log > > > > > > D:\oracle\admin>echo on > > > > > > D:\oracle\admin>FORFILES > > > -pd:\pslogs_psfm\fmdev8\_psprcsrvlog\ -s -m*.log > -d+0 -c"CMD > > > /c type d:\pslog > [EMAIL PROTECTED]|findstr ORA-03113 > > > >D:\oracle\admin\test.log" > > > > > > D:\oracle\admin>rem FORFILES > > > -pd:\pslogs_psfm\fmdev8\_psprcsrvlog\ -s -m*.log > -d+0 -c"CMD > > > /c type d:\p > [EMAIL PROTECTED]|findstr ORA-03113" > >NUL > > > > > > D:\oracle\admin>IF ERRORLEVEL 1 GOTO no > > > > > > D:\oracle\admin>IF NOT ERRORLEVEL 1 GOTO > RUN_PROC > > > > > > D:\oracle\admin>rem d:\psfm\start_proc_sched.bat > > > > > > D:\oracle\admin>echo run > > > run > > > > > > D:\oracle\admin>pause > > > Press any key to continue . . . > > > > > > D:\oracle\admin>goto end > > > > > > D:\oracle\admin>echo "finished" > > > "finished" > > > > > > D:\oracle\admin>rem if errorlevel 1 > @d:\psfm\start_proc_sched.bat > > > > > > Bob Metelsky wrote: > > > > > > > > echo off > > > > @cls > > > > find "ORA-124" C:\yourlog.txt >NUL > > > > > > > > IF ERRORLEVEL 1 GOTO no > > > > IF NOT ERRORLEVEL 1 GOTO yes > > > > > > > > :no > > > > ECHO NOT FOUND > > > > goto end > > > > > > > > :yes > > > > ECHO String IS found > > > > pause > > > > goto end > > > > > > > > :end > > > > exit > > > > > > > > > > > > > > Hi listers, > > > > > > > > > > I am working on a nt script. I download > FORFILE exe, it > > > works fine. > > > > > My intention is finding the ORA-03113 string > in the log. > > > If there is > > > > > a match, then reboot the server, else do > nothing. I don't have > > > > > problem with the findstr part. However, the > errorlevel > > > always return > > > > > 0, no matter it find the error or not. So > the if statement is > not > > > > > working. Can somebody give me some light on > NT syntax? On > > > unix, it > > > > > is so easy to script the condition. Please > help, > > > > > > > > > > Thanks, > > > > > > > > > > Joan > > > > > > > > > > > > > > > FORFILES > -pd:\pslogs_psfm\fmdev8\_psprcsrvlog\ -s -m*.log > > > > > -d+0 -c"CMD /c type > > > > > > d:[EMAIL PROTECTED]|findstr > ORA-03113" if > > > > > errorlevel 1 goto run_proc echo 'there is a > match' > > > > > > > > > > if errorlevel 0 goto end > > > > > echo 'there is no match' > > > > > > > > > > :run_proc > > > > > d:\start_proc.bat > > > > > goto end > > > > > > > > > > :end > > > > > -- > > > > > Please see the official ORACLE-L FAQ: > http://www.orafaq.net > > > > > -- > > > > > Author: Joan Hsieh > > > > > INET: [EMAIL PROTECTED] > > > > > > > > > > Fat City Network Services -- 858-538-5051 > > > http://www.fatcity.com > > > > > San Diego, California -- Mailing list > and web > > > hosting services > > > > > > > > > -------------------------------------------------------------------- > > > > > - > > > > > To REMOVE yourself from this mailing list, > send an E-Mail > message > > > > > to: [EMAIL PROTECTED] (note EXACT > spelling of 'ListGuru') > > > > > and in the message BODY, include a line > containing: UNSUB > > > > > ORACLE-L (or the name of mailing list you > want to be removed > > > > > from). You may also send the HELP command > for other > > > > > information (like subscribing). > > > > > > > > > -- > > > > Please see the official ORACLE-L FAQ: > http://www.orafaq.net > > > > -- > > > > Author: Bob Metelsky > > > > INET: [EMAIL PROTECTED] > > > > > > > > Fat City Network Services -- 858-538-5051 > http://www.fatcity.com > > > > San Diego, California -- Mailing list > and web > > > hosting services > > > > > > > > --------------------------------------------------------------------- > > > > To REMOVE yourself from this mailing list, > send an E-Mail message > > > > to: [EMAIL PROTECTED] (note EXACT spelling > of 'ListGuru') and > in > > > > the message BODY, include a line containing: > UNSUB ORACLE-L (or > the > > > > name of mailing list you want to be removed > from). You may > > > also send > > > > the HELP command for other information (like > subscribing). > > > -- > > > Please see the official ORACLE-L FAQ: > http://www.orafaq.net > > > -- > > > Author: Joan Hsieh > > > INET: [EMAIL PROTECTED] > > > > > > Fat City Network Services -- 858-538-5051 > http://www.fatcity.com > > > San Diego, California -- Mailing list and > web hosting > services > > > > --------------------------------------------------------------------- > > > To REMOVE yourself from this mailing list, send > an E-Mail message > > > to: [EMAIL PROTECTED] (note EXACT spelling of > 'ListGuru') > > > and in the message BODY, include a line > containing: UNSUB > > > ORACLE-L (or the name of mailing list you want > to be removed > > > from). You may also send the HELP command for > other > > > information (like subscribing). > > > > > -- > > Please see the official ORACLE-L FAQ: > http://www.orafaq.net > > -- > > Author: Bob Metelsky > > INET: [EMAIL PROTECTED] > > > > Fat City Network Services -- 858-538-5051 > http://www.fatcity.com > > San Diego, California -- Mailing list and > web hosting services > > > --------------------------------------------------------------------- > > To REMOVE yourself from this mailing list, send an > E-Mail message > > to: [EMAIL PROTECTED] (note EXACT spelling of > 'ListGuru') and in > > the message BODY, include a line containing: UNSUB > ORACLE-L > > (or the name of mailing list you want to be > removed from). You may > > also send the HELP command for other information > (like subscribing). > -- > Please see the official ORACLE-L FAQ: > http://www.orafaq.net > -- > Author: Joan Hsieh > INET: [EMAIL PROTECTED] > > Fat City Network Services -- 858-538-5051 > http://www.fatcity.com > San Diego, California -- Mailing list and web > hosting services > --------------------------------------------------------------------- > To REMOVE yourself from this mailing list, send an > E-Mail message > to: [EMAIL PROTECTED] (note EXACT spelling of > 'ListGuru') and in > the message BODY, include a line containing: UNSUB > ORACLE-L > (or the name of mailing list you want to be removed > from). You may > also send the HELP command for other information > (like subscribing). > -- > Please see the official ORACLE-L FAQ: > http://www.orafaq.net > -- > Author: Seefelt, Beth > INET: [EMAIL PROTECTED] > > Fat City Network Services -- 858-538-5051 > http://www.fatcity.com > San Diego, California -- Mailing list and web > hosting services > --------------------------------------------------------------------- > To REMOVE yourself from this mailing list, send an > E-Mail message > to: [EMAIL PROTECTED] (note EXACT spelling of > 'ListGuru') and in > the message BODY, include a line containing: UNSUB > ORACLE-L > (or the name of mailing list you want to be removed > from). You may > also send the HELP command for other information > (like subscribing). __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Jose Luis Delgado INET: [EMAIL PROTECTED] Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Seefelt, Beth INET: [EMAIL PROTECTED] Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).