[NBLUG/talk] top

Walter Hansen gandalf at sonic.net
Fri Dec 17 11:58:24 PST 2004


yes, that did the trick, seems to work fine now. Odd though I got a
nohup.out saying "top: bad iterations arg 'ohup'"

Now I put it in a shell script for easy implementation and ajustment and
it seems to be working fine without a nohup.out. I've set it to watch two
process names every sixty seconds. Hmmm. How outa control is 4 lines every
minute 24/7?

400 bytes * 60 = 24k
24k * 24 = .6m
.6m * 30 = 17m

17 megs a month, shouldn't be bad. I'll just delete it every once in a while.

> On Wed, Dec 15, 2004 at 11:48:22AM -0800, Walter Hansen wrote:
>>
>> 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.....
>
> I think this is egrep detecting output is a file and buffering.
>
> Try:
>
> nohup top -b -d 30 \
> 	| egrep --line-buffered 'Cpu(s)|load average|PID|swapper' \
> 	> toplog2.txt &
>
>  -Scott
> p.s. the grep(1) man page calls it "--line-buffering", but is incorrect --
> use "egrep --help" to see the real option.
>
>
> _______________________________________________
> talk mailing list
> talk at nblug.org
> http://nblug.org/cgi-bin/mailman/listinfo/talk
>
>






More information about the talk mailing list