From 74aed4c0119545aaa19fa68c4ed635ee80e944d7 Mon Sep 17 00:00:00 2001 From: ronivay Date: Sat, 4 Apr 2020 20:15:08 +0300 Subject: [PATCH] Add a system memory amount check and give warning in the menu when less than 3GB --- xo-install.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/xo-install.sh b/xo-install.sh index dc57660..139fbc4 100755 --- a/xo-install.sh +++ b/xo-install.sh @@ -656,6 +656,17 @@ function CheckCertificate { } 2>$LOGFILE +function CheckMemory { + SYSMEM=$(grep MemTotal /proc/meminfo | awk '{print $2}') + + if [[ $SYSMEM < 3000000 ]]; then + RAM="0" + else + RAM="1" + fi + +} + function PullDockerImage { echo @@ -674,6 +685,10 @@ function StartUpScreen { echo "-----------------------------------------" echo +if [[ $RAM == 0 ]]; then + echo -e "${COLOR_RED}WARNING: you have less than 3GB of RAM in your system. Installation might run out of memory${COLOR_N}" + echo +fi echo "This script will automatically install/update Xen-Orchestra" echo echo "- By default xo-server will be running as root to prevent issues with permissions and port binding." @@ -778,6 +793,7 @@ CheckUser CheckOS CheckSystemd CheckCertificate +CheckMemory if [[ $# == "1" ]]; then HandleArgs "$1"