Check RAM availability before install of matrix

This commit is contained in:
Bob Mottram 2017-06-20 14:09:42 +01:00
parent 5b9132c7ab
commit 108f98b6da
3 changed files with 14 additions and 6 deletions

View File

@ -452,12 +452,7 @@ function install_etherpad {
exit 7359
fi
# Check the amount of RAM
ram_available=$(grep MemTotal /proc/meminfo | awk '{print $2}')
if [ $ram_available -lt 2000000 ]; then
echo $'Need at least 2GB RAM to install etherpad'
exit 783524
fi
check_ram_availability 2
if [ -f $IMAGE_PASSWORD_FILE ]; then
ETHERPAD_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"

View File

@ -621,6 +621,8 @@ function install_home_server {
}
function install_matrix {
check_ram_availability 1.5
if [ ! -d $INSTALL_DIR ]; then
mkdir -p $INSTALL_DIR
fi

View File

@ -1028,4 +1028,15 @@ function combine_all_scripts {
done
}
function check_ram_availability {
minimum_ram_gb="$1"
minimum_ram_bytes=$((minimum_ram_gb * 1024 * 1024))
ram_available=$(grep MemTotal /proc/meminfo | awk '{print $2}')
if [ $ram_available -lt $minimum_ram_bytes ]; then
echo $"Need at least ${minimum_ram_gb}GB RAM to install this app"
exit 783524
fi
}
# NOTE: deliberately no exit 0