PC Review


Reply
Thread Tools Rate Thread

Detect the value from TypePerf

 
 
Kathy
Guest
Posts: n/a
 
      14th Sep 2006
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

 
Reply With Quote
 
 
 
 
foxidrive
Guest
Posts: n/a
 
      14th Sep 2006
On 13 Sep 2006 17:36:15 -0700, Kathy wrote:

> 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
 
Reply With Quote
 
Kathy
Guest
Posts: n/a
 
      14th Sep 2006
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).



foxidrive wrote:

> On 13 Sep 2006 17:36:15 -0700, Kathy wrote:
>
> > 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


 
Reply With Quote
 
foxidrive
Guest
Posts: n/a
 
      14th Sep 2006
On 13 Sep 2006 19:52:56 -0700, Kathy wrote:

> 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?


> foxidrive wrote:
>
>> On 13 Sep 2006 17:36:15 -0700, Kathy wrote:
>>
>>> 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

 
Reply With Quote
 
billious
Guest
Posts: n/a
 
      14th Sep 2006
"Kathy" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

[top-posting moved]

> foxidrive wrote:
>
>> On 13 Sep 2006 17:36:15 -0700, Kathy wrote:
>>
>> > 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

>
> 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.



 
Reply With Quote
 
Kathy Houtami
Guest
Posts: n/a
 
      14th Sep 2006
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


billious wrote:
> "Kathy" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
> [top-posting moved]
>
> > foxidrive wrote:
> >
> >> On 13 Sep 2006 17:36:15 -0700, Kathy wrote:
> >>
> >> > 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

> >
> > 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with TypePerf and interval option Mill#99 Microsoft Windows 2000 CMD Promt 3 23rd Oct 2008 08:36 AM
Problem with TypePerf and interval option Mill#99 Windows XP Performance 0 22nd Oct 2008 11:04 AM
Perfmon/Typeperf without a Pagefile... revert@gmail.com Windows XP Help 0 26th Oct 2006 11:27 PM
Parameter -si in Typeperf funktioniert nicht unter Windows XP =?Utf-8?B?Um9nZXJU?= Windows XP Performance 0 22nd Jun 2006 11:32 AM
Retrieve NIC card name for use with typeperf laphlaw Windows XP General 1 9th May 2006 07:29 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:40 AM.