|
|
@ -3,24 +3,26 @@ |
|
|
|
# Author: Daniel Gibbs |
|
|
|
# Contributor: UltimateByte |
|
|
|
# Website: https://gameservermanagers.com |
|
|
|
# Description: Checks RAM requirement |
|
|
|
# Description: Checks RAM requirements |
|
|
|
|
|
|
|
mbphysmem=$(free -m | awk '/Mem:/ {print $2}') |
|
|
|
local commandname="CHECK" |
|
|
|
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" |
|
|
|
|
|
|
|
# RAM requirement in MegaBytes for each game or engine |
|
|
|
info_distro.sh |
|
|
|
|
|
|
|
# RAM requirements in megabytes for each game or engine. |
|
|
|
if [ "${gamename}" == "Rust" ]; then |
|
|
|
ramrequirement="4000" |
|
|
|
ramrequirementmb="4000" |
|
|
|
ramrequirementgb="4" |
|
|
|
fi |
|
|
|
|
|
|
|
# If the game or engine has a minimum RAM Requirement, compare it to system's available RAM |
|
|
|
# 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." |
|
|
|
sleep 2 |
|
|
|
echo "" |
|
|
|
echo "You may encounter issues such as server lagging or shutting down unexpectedly." |
|
|
|
sleep 0.5 |
|
|
|
fn_script_log_warn "Insufficient physical RAM: ${mbphysmem}MB available for ${ramrequirement}MB required." |
|
|
|
fi |
|
|
|
fi |
|
|
|
if [ "${physmemtotalmb}" -lt "${ramrequirementmb}" ]; then |
|
|
|
# Warn the user |
|
|
|
fn_print_warn "Insufficient memory: ${ramrequirementgb}G required, ${physmemtotal} available" |
|
|
|
sleep 1 |
|
|
|
fn_print_warning "You may experiance poor performance from your server" |
|
|
|
sleep 1 |
|
|
|
fi |
|
|
|
fi |
|
|
|