Detect the value from TypePerf

K

Kathy

Hi,

I'd like to know if there is a way to detect the resulting value from
typeperf command then execute a batch file when the specific condition
is met.

What I'm trying to do is to check when typeperf "Web
Service(_Total)\Anonymous Users/sec" gives the result of 0.000000 then
execute a batch file.

Help???

Cheers
Kathy
 
F

foxidrive

Hi,

I'd like to know if there is a way to detect the resulting value from
typeperf command then execute a batch file when the specific condition
is met.

What I'm trying to do is to check when typeperf "Web
Service(_Total)\Anonymous Users/sec" gives the result of 0.000000 then
execute a batch file.

Help???

Cheers
Kathy

All on one line - untested.

typeperf "Web Service(_Total)\Anonymous Users/sec"|find "0.000000"&&call batchfile
 
K

Kathy

Hi Foxidrive

Thank you for your reply. I tried your suggestion, but it doesnt quite
work.

The result of command look like below:
C:\Documents and Settings\Default User>typeperf "Web
Service(_Total)\Anonymous Users/sec"|find "0.000000"&&call 2.bat
"09/14/2006 14:40:39.953","0.000000"
"09/14/2006 14:40:40.953","0.000000"
"09/14/2006 14:40:41.953","0.000000"
"09/14/2006 14:40:44.953","0.000000"
"09/14/2006 14:40:45.953","0.000000"
"09/14/2006 14:40:46.953","0.000000"
"09/14/2006 14:40:50.046","0.000000"
"09/14/2006 14:40:51.046","0.000000"
"09/14/2006 14:40:52.046","0.000000"
"09/14/2006 14:40:55.046","0.000000"
"09/14/2006 14:40:56.046","0.000000"
"09/14/2006 14:40:57.046","0.000000"

2.bat is a batch files to stop and disabled multiple Services.During
this process the 2.bat never got excuted (none of the listed Services
were stopped and disabled).
 
F

foxidrive

Hi Foxidrive

Thank you for your reply. I tried your suggestion, but it doesnt quite
work.

The result of command look like below:
C:\Documents and Settings\Default User>typeperf "Web
Service(_Total)\Anonymous Users/sec"|find "0.000000"&&call 2.bat
"09/14/2006 14:40:39.953","0.000000"
"09/14/2006 14:40:40.953","0.000000"
"09/14/2006 14:40:41.953","0.000000"
"09/14/2006 14:40:44.953","0.000000"
"09/14/2006 14:40:45.953","0.000000"
"09/14/2006 14:40:46.953","0.000000"
"09/14/2006 14:40:50.046","0.000000"
"09/14/2006 14:40:51.046","0.000000"
"09/14/2006 14:40:52.046","0.000000"
"09/14/2006 14:40:55.046","0.000000"
"09/14/2006 14:40:56.046","0.000000"
"09/14/2006 14:40:57.046","0.000000"

2.bat is a batch files to stop and disabled multiple Services.During
this process the 2.bat never got excuted (none of the listed Services
were stopped and disabled).

The problem seems to be with 2.bat - Try this line below: there is no
change except you should see "call 2.bat" echoed to the screen where it
would have been launched.

typeperf "Web Service(_Total)\Anonymous Users/sec"|find "0.000000"&&echo call 2.bat

You can remove the screen output from find by including >nul before the &&
but seeing it there proves that it is being detected by FIND and so 2.bat
should be launched. Which OS are you using?
 
B

billious

[top-posting moved]
Hi Foxidrive

Thank you for your reply. I tried your suggestion, but it doesnt quite
work.

The result of command look like below:
C:\Documents and Settings\Default User>typeperf "Web
Service(_Total)\Anonymous Users/sec"|find "0.000000"&&call 2.bat
"09/14/2006 14:40:39.953","0.000000"
"09/14/2006 14:40:40.953","0.000000"
"09/14/2006 14:40:41.953","0.000000"
"09/14/2006 14:40:44.953","0.000000"
"09/14/2006 14:40:45.953","0.000000"
"09/14/2006 14:40:46.953","0.000000"
"09/14/2006 14:40:50.046","0.000000"
"09/14/2006 14:40:51.046","0.000000"
"09/14/2006 14:40:52.046","0.000000"
"09/14/2006 14:40:55.046","0.000000"
"09/14/2006 14:40:56.046","0.000000"
"09/14/2006 14:40:57.046","0.000000"

2.bat is a batch files to stop and disabled multiple Services.During
this process the 2.bat never got excuted (none of the listed Services
were stopped and disabled).

The issue is that TYPEPERF does not CLOSE the output stream until it
terminates, hence FIND cannot see its input.

Try


typeperf -sc 1 "Web Service(_Total)\Anonymous Users/sec"|find
"0.000000"&&call 2.bat

which will exit TYPEPERF after 1 second, executing 2.bat if the output
contains "0.000000"
From there, it's a simple matter of instigating a loop, preferably with some
variety of exit-trigger

[1]:loop
[2]if exist exit-trigger.flag del exit-trigger.flag&goto :eof
[3]typeperf -sc 1 "Web Service(_Total)\Anonymous Users/sec"|find
"0.000000"&&call 2.bat
[4]goto loop

4 lines, each labelled [number]
This way, to stop the batch all you need do is create a file called
"exit-trigger.flag" - which can naturally have any name you so desire.
 
K

Kathy Houtami

Hi billious & foxidrive,

I tried both solutions and the one with the time limit (exit TYPEPERF
after 1 second) works like charmed.

Thank you so much to you both for helping me.

Cheers
Kathy

PS: I'm using Win Server 2003

[top-posting moved]
Hi Foxidrive

Thank you for your reply. I tried your suggestion, but it doesnt quite
work.

The result of command look like below:
C:\Documents and Settings\Default User>typeperf "Web
Service(_Total)\Anonymous Users/sec"|find "0.000000"&&call 2.bat
"09/14/2006 14:40:39.953","0.000000"
"09/14/2006 14:40:40.953","0.000000"
"09/14/2006 14:40:41.953","0.000000"
"09/14/2006 14:40:44.953","0.000000"
"09/14/2006 14:40:45.953","0.000000"
"09/14/2006 14:40:46.953","0.000000"
"09/14/2006 14:40:50.046","0.000000"
"09/14/2006 14:40:51.046","0.000000"
"09/14/2006 14:40:52.046","0.000000"
"09/14/2006 14:40:55.046","0.000000"
"09/14/2006 14:40:56.046","0.000000"
"09/14/2006 14:40:57.046","0.000000"

2.bat is a batch files to stop and disabled multiple Services.During
this process the 2.bat never got excuted (none of the listed Services
were stopped and disabled).

The issue is that TYPEPERF does not CLOSE the output stream until it
terminates, hence FIND cannot see its input.

Try


typeperf -sc 1 "Web Service(_Total)\Anonymous Users/sec"|find
"0.000000"&&call 2.bat

which will exit TYPEPERF after 1 second, executing 2.bat if the output
contains "0.000000"
From there, it's a simple matter of instigating a loop, preferably with some
variety of exit-trigger

[1]:loop
[2]if exist exit-trigger.flag del exit-trigger.flag&goto :eof
[3]typeperf -sc 1 "Web Service(_Total)\Anonymous Users/sec"|find
"0.000000"&&call 2.bat
[4]goto loop

4 lines, each labelled [number]
This way, to stop the batch all you need do is create a file called
"exit-trigger.flag" - which can naturally have any name you so desire.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top