Script to calculate installed memory.
Hello,
I am trying to write a script to calculate the total amount of installed memory to use during an anaconda kickscript, so the swap file is created at 2 x the installed memory. I so far have the amount of installed RAM DIMMS but need a way to total them up and produce a varible I can use in the pre section of the install. Code:
dmidecode -t 17 | grep Size | awk ' { print $2 }' I am guessing I need a while loop to do this and use expr but do not know where to start for this logic. Cheers |
Hi
Why not read /proc/meminfo? Code:
grep MemTotal /proc/meminfo |
Quote:
|
Hmm. If you just want the sum, awk can calculate it.
Code:
dmidecode -t 17 | grep Size | awk '{ SUM += $2} END { print SUM }' |
All times are GMT -5. The time now is 01:20 AM. |