Skip to content

Commit

Permalink
Feature/stats change (#4363)
Browse files Browse the repository at this point in the history
* feat: update unsupprted distros and add comments to info_distro

* remove tmux 1.6 code

* add java and tmux version and change ram to int

* tidy up ram requirements

used data gathered from analytics
  • Loading branch information
dgibbs64 authored Oct 30, 2023
1 parent d7964e0 commit 8830bad
Show file tree
Hide file tree
Showing 7 changed files with 154 additions and 165 deletions.
4 changes: 2 additions & 2 deletions lgsm/modules/check_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ fi
# Will warn user if their distro is no longer supported by the vendor.
if [ -n "${distrosupport}" ]; then
if [ "${distrosupport}" == "unsupported" ]; then
fn_print_warning_nl "${distroname} is no longer supported by the vendor. Upgrading is recommended."
fn_script_log_warn "${distroname} is no longer supported by the vendor. Upgrading is recommended."
fn_print_warning_nl "${distroname} is no longer supported by the vendor or LinuxGSM. Upgrading is recommended."
fn_script_log_warn "${distroname} is no longer supported by the vendor or LinuxGSM. Upgrading is recommended."
fi
fi

Expand Down
57 changes: 36 additions & 21 deletions lgsm/modules/check_system_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,57 @@ info_distro.sh
# RAM requirements in megabytes for each game or engine.

if [ "${shortname}" == "ark" ]; then
ramrequirementmb="4000"
ramrequirementgb="4"
ramrequirementgb="7"
elif [ "${shortname}" == "arma3" ]; then
ramrequirementgb="2"
elif [ "${shortname}" == "armar" ]; then
ramrequirementgb="3"
elif [ "${shortname}" == "bt" ]; then
ramrequirementmb="1000"
ramrequirementgb="1"
elif [ "${shortname}" == "mh" ]; then
ramrequirementmb="4000"
ramrequirementgb="4"
elif [ "${shortname}" == "arma3" ]; then
ramrequirementmb="1000"
elif [ "${shortname}" == "cc" ]; then
ramrequirementgb="1"
elif [ "${shortname}" == "rust" ]; then
ramrequirementmb="4000"
elif [ "${shortname}" == "dayz" ]; then
ramrequirementgb="5"
elif [ "${shortname}" == "dodr" ]; then
ramrequirementgb="2"
elif [ "${shortname}" == "hw" ]; then
ramrequirementgb="3"
elif [ "${shortname}" == "mc" ]; then
ramrequirementgb="1"
elif [ "${shortname}" == "pmc" ]; then
ramrequirementgb="2"
elif [ "${shortname}" == "mh" ]; then
ramrequirementgb="4"
elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "wmc" ]; then
ramrequirementmb="1000"
elif [ "${shortname}" == "ns2" ] || [ "${shortname}" == "ns2c" ]; then
ramrequirementgb="1"
elif [ "${shortname}" == "ps" ]; then
ramrequirementmb="2000"
ramrequirementgb="2"
elif [ "${shortname}" == "ns2" ] || [ "${shortname}" == "ns2c" ]; then
ramrequirementmb="1000"
elif [ "${shortname}" == "pvr" ]; then
ramrequirementgb="1"
elif [ "${shortname}" == "pz" ]; then
ramrequirementgb="3"
elif [ "${shortname}" == "rust" ]; then
ramrequirementgb="9"
elif [ "${shortname}" == "sdtd" ]; then
ramrequirementgb="4"
elif [ "${shortname}" == "squad" ]; then
ramrequirementgb="2"
elif [ "${shortname}" == "st" ]; then
ramrequirementmb="1000"
ramrequirementgb="1"
elif [ "${shortname}" == "pvr" ]; then
ramrequirementmb="2000"
elif [ "${shortname}" == "stn" ]; then
ramrequirementgb="3"
elif [ "${shortname}" == "tu" ]; then
ramrequirementgb="2"
elif [ "${shortname}" == "vh" ]; then
ramrequirementgb="2"
else
ramrequirementgb="0.5"
fi

# If the game or engine has a minimum RAM Requirement, compare it to system's available RAM.
if [ "${ramrequirementmb}" ]; then
if [ "${physmemtotalmb}" -lt "${ramrequirementmb}" ]; then
if [ "${ramrequirementgb}" ]; then
if [ "${physmemtotalgb}" -lt "${ramrequirementgb}" ]; then
fn_print_dots "Checking RAM"
# Warn the user.
fn_print_warn_nl "Checking RAM: ${ramrequirementgb}G required, ${physmemtotal} available"
echo "* ${gamename} server may fail to run or experience poor performance."
fn_sleep_time_5
Expand Down
2 changes: 1 addition & 1 deletion lgsm/modules/command_debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn_print_header
echo -e "${lightblue}Architecture:\t\t${default}${arch}"
echo -e "${lightblue}Kernel:\t\t${default}${kernel}"
echo -e "${lightblue}Hostname:\t\t${default}${HOSTNAME}"
echo -e "${lightblue}tmux:\t\t${default}${tmuxv}"
echo -e "${lightblue}tmux:\t\t${default}${tmuxversion}"
echo -e "${lightblue}Avg Load:\t\t${default}${load}"
echo -e "${lightblue}Free Memory:\t\t${default}${physmemfree}"
echo -e "${lightblue}Free Disk:\t\t${default}${availspace}"
Expand Down
46 changes: 11 additions & 35 deletions lgsm/modules/command_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,47 +73,23 @@ fn_start_tmux() {
touch "${consolelog}"

# tmux compiled from source will return "master", therefore ignore it.
if [ "${tmuxv}" == "master" ]; then
if [ "${tmuxversion}" == "master" ]; then
fn_script_log "tmux version: master (user compiled)"
echo -e "tmux version: master (user compiled)" >> "${consolelog}"
if [ "${consolelogging}" == "on" ] || [ -z "${consolelogging}" ]; then
if [ "${logtimestamp}" == "on" ]; then
tmux -L "${socketname}" pipe-pane -o -t "${sessionname}" "exec bash -c \"cat | $addtimestamp\" >> '${consolelog}'"
else
tmux -L "${socketname}" pipe-pane -o -t "${sessionname}" "exec cat >> '${consolelog}'"
fi
fi
fi

elif [ -n "${tmuxv}" ]; then
# tmux pipe-pane not supported in tmux versions < 1.6.
if [ "${tmuxvdigit}" -lt "16" ]; then
echo -e "Console logging disabled: tmux => 1.6 required
https://linuxgsm.com/tmux-upgrade
Currently installed: $(tmux -V)" > "${consolelog}"

# Console logging disabled: Bug in tmux 1.8 breaks logging.
elif [ "${tmuxvdigit}" -eq "18" ]; then
echo -e "Console logging disabled: Bug in tmux 1.8 breaks logging
https://linuxgsm.com/tmux-upgrade
Currently installed: $(tmux -V)" > "${consolelog}"
# Console logging enable or not set.
elif [ "${consolelogging}" == "on" ] || [ -z "${consolelogging}" ]; then
if [ "${logtimestamp}" == "on" ]; then
tmux -L "${socketname}" pipe-pane -o -t "${sessionname}" "exec bash -c \"cat | $addtimestamp\" >> '${consolelog}'"
else
tmux -L "${socketname}" pipe-pane -o -t "${sessionname}" "exec cat >> '${consolelog}'"
fi
# Enable console logging.
if [ "${consolelogging}" == "on" ] || [ -z "${consolelogging}" ]; then
if [ "${logtimestamp}" == "on" ]; then
tmux -L "${socketname}" pipe-pane -o -t "${sessionname}" "exec bash -c \"cat | $addtimestamp\" >> '${consolelog}'"
else
tmux -L "${socketname}" pipe-pane -o -t "${sessionname}" "exec cat >> '${consolelog}'"
fi
else
echo -e "Unable to detect tmux version" >> "${consolelog}"
fn_script_log_warn "Unable to detect tmux version"
fi

# Console logging disabled.
if [ "${consolelogging}" == "off" ]; then
echo -e "Console logging disabled in settings" >> "${consolelog}"
fn_script_log_info "Console logging disabled by user"
fn_script_log_info "Console logging disabled in settings"
fi

fn_sleep_time_1

# If the server fails to start.
Expand All @@ -123,7 +99,7 @@ fn_start_tmux() {
fn_script_log_fail "Unable to start ${servername}"
if [ -s "${lgsmlogdir}/.${selfname}-tmux-error.tmp" ]; then
fn_print_fail_nl "Unable to start ${servername}: tmux error:"
fn_script_log_fail "Unable to start ${servername}: tmux error:"
fn_script_log_fail "Unable to start ${servername}: tmux error"
echo -e ""
echo -e "Command"
fn_messages_separator
Expand Down
Loading

0 comments on commit 8830bad

Please sign in to comment.