Help with memory usage
aragonx at dcsnow.com
aragonx at dcsnow.com
Fri Jan 11 23:37:32 UTC 2008
> Change:
>
>> ps -ef|grep $1|grep -v grep|tr -s " "|cut -d " " -f2 >
>> /tmp/will_memory_usage.txt
>
> to: ps -ef|grep $1|grep =v grep|tr =s " "|cut -d " " -f2 >>
> /tmp/will_memory_usage.txt
>
> The second > will cause the line to be appended to the file rather than
> write a single line file.
Thanks for the reply. I do not think this line is in error. It does
indeed write multiple lines to the file. The second > would allow me to
append to the file during additional loops, if I had any. Each of the
commands (ps, grep, tr and cut) all return the entire output as a single
input to the next level so it does indeed calculate totals. They are just
way out of whack because each process reports it's total memory usage that
also includes shared libraries which every other process is using.
Here is a sample output:
# ./memory_usage.bash oracle
oracle virtual memory usage is 657999784.
oracle real memory usage is 45185172.
Total oracle memory usage is 703184956.
# free
total used free shared buffers cached
Mem: 32394788 27076656 5318132 0 2748624 16499256
-/+ buffers/cache: 7828776 24566012
Swap: 20265948 434284 19831664
mcidm4:/opt/will #
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the users
mailing list