1827296 Members
2147 Online
109960 Solutions
New Discussion

Re: top utility

 
SOLVED
Go to solution
Rahul_13
Advisor

top utility

Hi,

I want to write a script that would execute 'top' in the background for 1 hour time and collect the reports in a file.

Can anyone please help me.

Thanks,
Rahul
3 REPLIES 3
Prashant Zanwar_4
Respected Contributor
Solution

Re: top utility

You can do this just by using top.

top -s time -d count -n number -f filename &

-s time = delay (2 seconds you can say)
-d count = count delays ( say 30 times)
-n number (processes per screen)
-f output file where data to be collected.

I hope this helps

Prashant
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
Geoff Wild
Honored Contributor

Re: top utility

Well, you could do:

top -f /tmp/top.out

and run it however many times you like...

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
romano r
Frequent Advisor

Re: top utility

I think instead of top, you may use "sar" (see the man page also for sa components)suitable to collect statistics data also in back ground. Furthemrore "-f" option it is not present in all HP-UX releases.

rgds.
romano