Browse Source

Merge pull request #946 from dgibbs64/systemrequirements

System requirements
pull/942/merge
Daniel Gibbs 9 years ago
committed by GitHub
parent
commit
811d827750
  1. 8
      lgsm/functions/check.sh
  2. 28
      lgsm/functions/check_system_requirements.sh
  3. 5
      lgsm/functions/core_functions.sh
  4. 2
      lgsm/functions/info_distro.sh

8
lgsm/functions/check.sh

@ -83,3 +83,11 @@ do
check_status.sh
fi
done
local allowed_commands_array=( command_install.sh command_start.sh command_debug.sh )
for allowed_command in "${allowed_commands_array[@]}"
do
if [ "${allowed_command}" == "${function_selfname}" ]; then
check_system_requirements.sh
fi
done

28
lgsm/functions/check_system_requirements.sh

@ -0,0 +1,28 @@
#!/bin/bash
# LGSM check_system_requirements.sh
# Author: Daniel Gibbs
# Contributor: UltimateByte
# Website: https://gameservermanagers.com
# Description: Checks RAM requirements
local commandname="CHECK"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
info_distro.sh
# RAM requirements in megabytes for each game or engine.
if [ "${gamename}" == "Rust" ]; then
ramrequirementmb="4000"
ramrequirementgb="4"
fi
# If the game or engine has a minimum RAM Requirement, compare it to system's available RAM.
if [ -n "${ramrequirement}" ]; then
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

5
lgsm/functions/core_functions.sh

@ -222,6 +222,11 @@ functionfile="${FUNCNAME}"
fn_fetch_function
}
check_system_requirements.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function
}
check_tmux.sh(){
functionfile="${FUNCNAME}"
fn_fetch_function

2
lgsm/functions/info_distro.sh

@ -61,6 +61,7 @@ else
fi
physmemtotal=$(free ${humanreadable} | awk '/Mem:/ {print $2}')
physmemtotalmb=$(free -m | awk '/Mem:/ {print $2}')
physmemused=$(free ${humanreadable} | awk '/Mem:/ {print $3}')
physmemfree=$(free ${humanreadable} | awk '/Mem:/ {print $4}')
physmemcached=$(free ${humanreadable} | awk '/cache:/ {print $4}')
@ -68,7 +69,6 @@ swaptotal=$(free ${humanreadable} | awk '/Swap:/ {print $2}')
swapused=$(free ${humanreadable} | awk '/Swap:/ {print $3}')
swapfree=$(free ${humanreadable} | awk '/Swap:/ {print $4}')
### Disk Infomation
## Available disk space on the partition.

Loading…
Cancel
Save