[NBLUG/talk] top
Walter Hansen
gandalf at sonic.net
Wed Dec 15 11:48:22 PST 2004
Hmmm. Been a while since I played with shell scripts. I probably should
take the class some time.
I got:
top -b -d 30 | egrep 'Cpu(s)|load average|PID|nusd'
to work but when I try to redirect output to a file it doesn't:
top -b -d 30 | egrep 'Cpu(s)|load average|PID|nusd' > toplog.txt
and it also didn't work when I did this:
nohup top -b -d 30 | egrep 'Cpu(s)|load average|PID|nusd' > toplog2.txt &
or when I put the above command in a file made it +x and then ran it.
Although in both of the last cases I could see the top process running.
Hmmm. I guess I'd better go kill those processes.....
> On Wed, Dec 15, 2004 at 10:41:41AM -0800, sms at sonic.net wrote:
>> > Anybody know if there is a way to log top information or similar
>> > information. I'm interested in a couple of processes and their CPU
>> usage
>> > over about a half hour time period. I'd also like the overall system
>> > usage over the period. I can probably watch it manually most nights,
>> > but I'd like to know whether I'm there or not.
>>
>> Is there any reason you don't want to use a simple script? E.g.
>>
>> touch topper
>> date >> topper
>> echo " " >> topper
>> while (whatever-condition-suits-your-need)
>> do
>> top n 1 >> topper
>> echo "=======================================================" >>
>> topper
>> sleep 30 # That's a snapshot every 30 seconds; change as needed
>> done
>
> You can also run top in "batch" mode with -b -- this produces dumb
> terminal
> output.
>
> -Scott
>
> _______________________________________________
> talk mailing list
> talk at nblug.org
> http://nblug.org/cgi-bin/mailman/listinfo/talk
>
>
More information about the talk
mailing list