From: Todd Sharp <41924046+recursivecodes@users.noreply.github.com> Date: Mon, 28 Oct 2019 01:58:56 +0000 (-0400) Subject: Change check for linux memory (#452) X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=20e812e3d8f37818aaaf9d5e2775cd45653c40c2;p=discourse_docker.git 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 --- diff --git a/discourse-setup b/discourse-setup index 205d4a0..c4daa6b 100755 --- a/discourse-setup +++ b/discourse-setup @@ -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 } ##