From c89500cbacaafda094a40d0a8d553018936f1a61 Mon Sep 17 00:00:00 2001 From: UltimateByte Date: Tue, 26 Jul 2016 19:56:44 +0200 Subject: [PATCH] Init RAM requirement check --- lgsm/functions/check_system_requirements.sh | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lgsm/functions/check_system_requirements.sh diff --git a/lgsm/functions/check_system_requirements.sh b/lgsm/functions/check_system_requirements.sh new file mode 100644 index 000000000..dde47efb0 --- /dev/null +++ b/lgsm/functions/check_system_requirements.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# LGSM check_system_requirements.sh +# Author: Daniel Gibbs +# Contributor: UltimateByte +# Website: https://gameservermanagers.com +# Description: Checks RAM requirement + +mbphysmem=$(free -m | awk '/Mem:/ {print $2}') + +# RAM requirement in MegaBytes for each game or engine +if [ "${gamename} == "Rust" ]; then + ramrequirement="4000" +fi + +# If the game or engine has a minimum RAM Requirement, compare it to system's available RAM +if [ -n "${ramrequirement}" ]; then + if [ "${mbphysmem}" -lt "${ramrequirement} ]; then + # Warn the user + fn_print_warn "Insufficient physical RAM: ${mbphysmem}MB available for ${ramrequirement}MB required." + echo "You may encounter issues such as server lagging or shutting down unexpectedly." + fn_script_log_warn "Insufficient physical RAM: ${mbphysmem}MB available for ${ramrequirement}MB required." + fi +fi