|
Answer» I am trying to create a way to check the result of a query.
code I am using
sc query "World Wide Web Publishing" > web.log
Then from here I need it to check the web.log for "RUNNING" if its runnning goto:up
If its not "RUNNING" goto:down
I have the program to send me the email I just don't know how to code the check of the web.log
:up exit :down blat email = myaddress.commay i suggest...
Code: [Select] find "running" c:\%pathtofile%\web.log if errorlevel 1 goto down exit
:down blat email = myaddress.com please GET back to say WHETHER this works or not
FBor this
Code: [Select]sc query "World Wide Web Publishing" > web.log type web.log | find "RUNNING">NUL && goto up goto down Thanks a bunch I used the if errorlevel 1 and this is working great.I have added the example for others if they need it this is not a full proof way to check your IIS Site and Service but it will do a basic check for if the IIS is up and if the Service is up and then email me if it is down.
It does use wget to DOWNLOAD the index.html so you WOULD nee that program to use this code. Also it uses a program called blat to email me.
del "index.html" sc query "Service" > service.log find "RUNNING" service.log if errorlevel 1 goto :down wget --output-file=wget.log http://domainname If exist "index.html" goto :up If not exist "index.html" goto :down :up exit :down blat site.txt -to [email protected]
|