Cool Solutions

Determining Total System RAM for Use in ZENworks Imaging Scripts



By:

January 23, 2008 6:55 am

Reads: 5672

Comments:0

Score:0

Someone in the Novell Support Forums was asking for some help on how to determine how much total system RAM was in a computer.

If the amount of RAM was greater than 512 megs, then he wanted to restore an add-on image for an application which required 512+ megs of RAM to run properly.

I was able to use the following command to output the total amount of system RAM into the variable RAMTOAL:

RAMTOTAL=`free | awk ‘/Mem:/ {print $2}’`

You can verify this by typing:

free

On my test system I see the following output:

Note that my total RAM is listed as 516352.

Then type:

echo $RAMTOTAL

The value stored in the variable RAMTOTAL evaluates to 516352.

You could do something similar for “Used RAM” and “Free RAM”, though it is probably not as useful:

RAMUSED=`free | awk ‘/Mem:/ {print $3}’`
RAMFREE=`free | awk ‘/Mem:/ {print $4}’`

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Tags:
Categories: Uncategorized

Disclaimer: This content is not supported by Novell. It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test it thoroughly before using it in a production environment.

Comment

RSS