Change check for linux memory (#452)

* Change check for linux memory

Some VMs clock in at *just under* 1GB, so checking for 1GB of RAM will miss these.  Instead, check for MB, divide by 1000 and round up.

* Refine the check_linux_memory function

Be a little more precise and only make an exception for VMs with >= 990MB RAM
This commit is contained in:
Todd Sharp 2019-10-27 21:58:56 -04:00 committed by Sam
parent b6379984c2
commit 20e812e3d8
1 changed files with 9 additions and 1 deletions

View File

@ -114,7 +114,15 @@ check_osx_memory() {
## Linux available memory
##
check_linux_memory() {
echo `free -g --si | awk ' /Mem:/ {print $2} '`
## some VMs report just under 1GB of RAM, so
## make an exception and allow those with more
## than 989MB
mem=`free -m --si | awk ' /Mem:/ {print $2}'`
if [ "$mem" -ge 990 -a "$mem" -lt 1000 ]; then
echo 1
else
echo `free -g --si | awk ' /Mem:/ {print $2} '`
fi
}
##