mirror of
https://github.com/GameServerManagers/LinuxGSM.git
synced 2025-01-08 12:07:37 +08:00
feat: general code standards improvements (#2730)
* add missing space in ; then * standardise command if * standardised True if the length of "STRING" is non-zero. * changed -e to -f
This commit is contained in:
parent
3a6f7f9034
commit
abaa614cad
@ -28,14 +28,14 @@ tickrate="30" # default 30; range : 15 to 100
|
||||
## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
|
||||
fn_parms(){
|
||||
# Specific to Rust
|
||||
if [ -n "${seed}" ]; then
|
||||
if [ "${seed}" ]; then
|
||||
# If set, then add to start parms
|
||||
conditionalseed="+server.seed ${seed}"
|
||||
else
|
||||
# Keep randomness of the number if not set
|
||||
conditionalseed=""
|
||||
fi
|
||||
if [ -n "${salt}" ]; then
|
||||
if [ "${salt}" ]; then
|
||||
# If set, then add to start parms
|
||||
conditionalsalt="+server.salt ${salt}"
|
||||
else
|
||||
|
@ -57,7 +57,7 @@ fn_print_dots "Sending Discord alert"
|
||||
|
||||
discordsend=$(curl -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "$json" | jq -c .)" "${discordwebhook}")
|
||||
|
||||
if [ -n "${discordsend}" ]; then
|
||||
if [ "${discordsend}" ]; then
|
||||
fn_print_fail_nl "Sending Discord alert: ${discordsend}"
|
||||
fn_script_log_fatal "Sending Discord alert: ${discordsend}"
|
||||
else
|
||||
|
@ -11,7 +11,7 @@ local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
|
||||
fn_print_dots "Sending Email alert: ${email}"
|
||||
fn_sleep_time
|
||||
|
||||
if [ -n "${emailfrom}" ]; then
|
||||
if [ "${emailfrom}" ]; then
|
||||
mail -s "${alertsubject}" -r "${emailfrom}" "${email}" < "${alertlog}"
|
||||
else
|
||||
mail -s "${alertsubject}" "${email}" < "${alertlog}"
|
||||
|
@ -20,7 +20,7 @@ EOF
|
||||
fn_print_dots "Sending IFTTT alert"
|
||||
iftttsend=$(curl -sSL -H "Content-Type: application/json" -X POST -d """${json}""" "https://maker.ifttt.com/trigger/${iftttevent}/with/key/${ifttttoken}" | grep "Bad Request")
|
||||
|
||||
if [ -n "${iftttsend}" ]; then
|
||||
if [ "${iftttsend}" ]; then
|
||||
fn_print_fail_nl "Sending IFTTT alert: ${pushbulletsend}"
|
||||
fn_script_log_fatal "Sending IFTTT alert: ${pushbulletsend}"
|
||||
else
|
||||
|
@ -21,7 +21,7 @@ EOF
|
||||
fn_print_dots "Sending Pushbullet alert"
|
||||
pushbulletsend=$(curl -sSL -u """${pushbullettoken}"":" -H "Content-Type: application/json" -X POST -d """${json}""" "https://api.pushbullet.com/v2/pushes" | grep "error_code")
|
||||
|
||||
if [ -n "${pushbulletsend}" ]; then
|
||||
if [ "${pushbulletsend}" ]; then
|
||||
fn_print_fail_nl "Sending Pushbullet alert: ${pushbulletsend}"
|
||||
fn_script_log_fatal "Sending Pushbullet alert: ${pushbulletsend}"
|
||||
else
|
||||
|
@ -25,7 +25,7 @@ fi
|
||||
|
||||
pushoversend=$(curl -sS -F token="${pushovertoken}" -F user="${pushoveruserkey}" -F html="1" -F sound="${alertsound}" -F priority="${alertpriority}" -F title="${alertemoji} ${alertsubject} ${alertemoji}" -F message=" <b>Message</b><br>${alertbody}<br><br><b>Game</b><br>${gamename}<br><br><b>Server name</b><br>${servername}<br><br><b>Hostname</b><br>${HOSTNAME}<br><br><b>Server IP</b><br><a href='https://www.gametracker.com/server_info/${alertip}:${port}'>${alertip}:${port}</a><br><br><b>More info</b><br><a href='${alerturl}'>${alerturl}</a>" "https://api.pushover.net/1/messages.json" | grep errors)
|
||||
|
||||
if [ -n "${pushoversend}" ]; then
|
||||
if [ "${pushoversend}" ]; then
|
||||
fn_print_fail_nl "Sending Pushover alert: ${pushoversend}"
|
||||
fn_script_log_fatal "Sending Pushover alert: ${pushoversend}"
|
||||
else
|
||||
|
@ -20,7 +20,7 @@ EOF
|
||||
fn_print_dots "Sending Telegram alert"
|
||||
telegramsend=$(curl -sSL -H "Content-Type: application/json" -X POST -d """${json}""" "https://api.telegram.org/bot${telegramtoken}/sendMessage" "${curlcustomstring}" | grep "error_code")
|
||||
|
||||
if [ -n "${telegramsend}" ]; then
|
||||
if [ "${telegramsend}" ]; then
|
||||
fn_print_fail_nl "Sending Telegram alert: ${telegramsend}"
|
||||
fn_script_log_fatal "Sending Telegram alert: ${telegramsend}"
|
||||
else
|
||||
|
@ -82,7 +82,7 @@ local allowed_commands_array=( update_steamcmd.sh command_debug.sh command_start
|
||||
for allowed_command in "${allowed_commands_array[@]}"
|
||||
do
|
||||
if [ "${allowed_command}" == "${function_selfname}" ]; then
|
||||
if [ -n "${appid}" ]; then
|
||||
if [ "${appid}" ]; then
|
||||
check_steamcmd.sh
|
||||
fi
|
||||
fi
|
||||
|
@ -7,7 +7,7 @@
|
||||
local modulename="CHECK"
|
||||
local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||
|
||||
if [ ! -e "${servercfgfullpath}" ]; then
|
||||
if [ ! -f "${servercfgfullpath}" ]; then
|
||||
if [ "${shortname}" != "hw" ]&&[ "${shortname}" != "ut3" ]&&[ "${shortname}" != "kf2" ]; then
|
||||
fn_print_dots ""
|
||||
fn_print_warn_nl "Configuration file missing!"
|
||||
|
@ -79,7 +79,7 @@ fn_install_mono_repo(){
|
||||
echo -e " https://www.mono-project.com/download/stable/#download-lin"
|
||||
monoautoinstall="1"
|
||||
fi
|
||||
if [ "${monoautoinstall}" != "1" ];then
|
||||
if [ "${monoautoinstall}" != "1" ]; then
|
||||
if [ $? != 0 ]; then
|
||||
fn_print_failure_nl "Unable to install Mono repository."
|
||||
fn_script_log_fatal "Unable to installMono repository."
|
||||
@ -183,7 +183,7 @@ if [ "${javacheck}" == "1" ]; then
|
||||
fn_sleep_time
|
||||
fi
|
||||
# Define required dependencies for SteamCMD.
|
||||
if [ -n "${appid}" ]; then
|
||||
if [ "${appid}" ]; then
|
||||
if [ "${deptocheck}" == "glibc.i686" ]||[ "${deptocheck}" == "libstdc++64.i686" ]||[ "${deptocheck}" == "lib32gcc1" ]||[ "${deptocheck}" == "lib32stdc++6" ]; then
|
||||
steamcmdfail=1
|
||||
fi
|
||||
@ -225,10 +225,10 @@ fn_found_missing_deps(){
|
||||
fn_print_warning_nl "Missing dependencies: ${red}${array_deps_missing[@]}${default}"
|
||||
fn_script_log_warn "Missing dependencies: ${array_deps_missing[@]}"
|
||||
fn_sleep_time
|
||||
if [ -n "${monostatus}" ]; then
|
||||
if [ "${monostatus}" ]; then
|
||||
fn_install_mono_repo
|
||||
fi
|
||||
if [ -n "${jqstatus}" ]; then
|
||||
if [ "${jqstatus}" ]; then
|
||||
fn_print_warning_nl "jq is not available in the ${distroname} repository."
|
||||
echo -e " * https://docs.linuxgsm.com/requirements/jq"
|
||||
fi
|
||||
|
@ -76,7 +76,7 @@ if [ "${travistest}" != "1" ]; then
|
||||
fn_script_log_fatal "IP address not set in game config."
|
||||
fn_script_log_fatal "Specify the IP you want to bind within: ${servercfgfullpath}."
|
||||
fn_script_log_fatal "https://linuxgsm.com/network-interfaces\n"
|
||||
if [ "${function_selfname}" != "command_details.sh" ];then
|
||||
if [ "${function_selfname}" != "command_details.sh" ]; then
|
||||
core_exit.sh
|
||||
fi
|
||||
else
|
||||
|
@ -21,6 +21,6 @@ fi
|
||||
|
||||
# Create gamelogdir.
|
||||
# If variable exists gamelogdir exists and log/server does not.
|
||||
if [ -n "${gamelogdir}" ]&&[ -d "${gamelogdir}" ]&&[ ! -d "${logdir}/server" ]; then
|
||||
if [ "${gamelogdir}" ]&&[ -d "${gamelogdir}" ]&&[ ! -d "${logdir}/server" ]; then
|
||||
fn_check_logs
|
||||
fi
|
||||
|
@ -72,7 +72,7 @@ fn_check_permissions(){
|
||||
fi
|
||||
|
||||
# Check rootdir permissions.
|
||||
if [ -n "${rootdir}" ]; then
|
||||
if [ "${rootdir}" ]; then
|
||||
# Get permission numbers on directory under the form 775.
|
||||
rootdirperm=$(stat -c %a "${rootdir}")
|
||||
# Grab the first and second digit for user and group permission.
|
||||
|
@ -42,7 +42,7 @@ elif [ "${shortname}" == "st" ]; then
|
||||
fi
|
||||
|
||||
# If the game or engine has a minimum RAM Requirement, compare it to system's available RAM.
|
||||
if [ -n "${ramrequirementmb}" ]; then
|
||||
if [ "${ramrequirementmb}" ]; then
|
||||
if [ "${physmemtotalmb}" -lt "${ramrequirementmb}" ]; then
|
||||
fn_print_dots "Check RAM"
|
||||
# Warn the user.
|
||||
|
@ -8,7 +8,7 @@
|
||||
local modulename="CHECK"
|
||||
|
||||
fn_check_is_in_tmux(){
|
||||
if [ -n "${TMUX}" ]; then
|
||||
if [ "${TMUX}" ]; then
|
||||
fn_print_fail_nl "tmuxception error: Sorry Cobb you cannot start a tmux session inside of a tmux session."
|
||||
fn_script_log_fatal "Tmuxception error: Attempted to start a tmux session inside of a tmux session."
|
||||
fn_print_information_nl "LinuxGSM creates a tmux session when starting the server."
|
||||
@ -19,7 +19,7 @@ fn_check_is_in_tmux(){
|
||||
}
|
||||
|
||||
fn_check_is_in_screen(){
|
||||
if [ -n "${STY}" ]; then
|
||||
if [ "${STY}" ]; then
|
||||
fn_print_fail_nl "tmuxception error: Sorry Cobb you cannot start a tmux session inside of a screen session."
|
||||
fn_script_log_fatal "Tmuxception error: Attempted to start a tmux session inside of a screen session."
|
||||
fn_print_information_nl "LinuxGSM creates a tmux session when starting the server."
|
||||
|
@ -159,7 +159,7 @@ fn_backup_compression(){
|
||||
# Clear old backups according to maxbackups and maxbackupdays variables.
|
||||
fn_backup_prune(){
|
||||
# Clear if backup variables are set.
|
||||
if [ -n "${maxbackups}" ]&&[ -n "${maxbackupdays}" ]; then
|
||||
if [ "${maxbackups}" ]&&[ -n "${maxbackupdays}" ]; then
|
||||
# How many backups there are.
|
||||
info_distro.sh
|
||||
# How many backups exceed maxbackups.
|
||||
|
@ -37,7 +37,7 @@ fn_print_header
|
||||
echo -e "${lightblue}Free Disk:\t\t${default}${availspace}"
|
||||
} | column -s $'\t' -t
|
||||
# glibc required.
|
||||
if [ -n "${glibc}" ]; then
|
||||
if [ "${glibc}" ]; then
|
||||
if [ "${glibc}" == "null" ]; then
|
||||
# Glibc is not required.
|
||||
:
|
||||
@ -57,21 +57,21 @@ else
|
||||
echo -e "${lightblue}Server IP:\t${default}${ip}:${port}"
|
||||
fi
|
||||
# External server IP.
|
||||
if [ -n "${extip}" ]; then
|
||||
if [ "${extip}" ]; then
|
||||
if [ "${ip}" != "${extip}" ]; then
|
||||
echo -e "${lightblue}Internet IP:\t${default}${extip}:${port}"
|
||||
fi
|
||||
fi
|
||||
# Listed on Master Server.
|
||||
if [ "${displaymasterserver}" ];then
|
||||
if [ "${displaymasterserver}" == "true" ];then
|
||||
if [ "${displaymasterserver}" ]; then
|
||||
if [ "${displaymasterserver}" == "true" ]; then
|
||||
echo -e "${lightblue}Master Server:\t${green}${displaymasterserver}${default}"
|
||||
else
|
||||
echo -e "${lightblue}Master Server:\t${red}${displaymasterserver}${default}"
|
||||
fi
|
||||
fi
|
||||
# Server password.
|
||||
if [ -n "${serverpassword}" ]; then
|
||||
if [ "${serverpassword}" ]; then
|
||||
echo -e "${lightblue}Server password:\t${default}${serverpassword}"
|
||||
fi
|
||||
echo -e "${lightblue}Start parameters:${default}"
|
||||
|
@ -13,7 +13,7 @@ echo -e "================================="
|
||||
echo -e "glibc Requirements Checker"
|
||||
echo -e "================================="
|
||||
|
||||
if [ -z "$(command -v objdump)" ]; then
|
||||
if [ ! "$(command -v objdump)" ]; then
|
||||
fn_print_failure_nl "objdump is missing"
|
||||
fn_script_log_fatal "objdump is missing"
|
||||
core_exit.sh
|
||||
|
@ -23,7 +23,7 @@ luafastdlfile="lgsm_cl_force_fastdl.lua"
|
||||
luafastdlfullpath="${luasvautorundir}/${luafastdlfile}"
|
||||
|
||||
# Check if bzip2 is installed.
|
||||
if [ -z "$(command -v bzip2 2>/dev/null)" ]; then
|
||||
if [ ! "$(command -v bzip2 2>/dev/null)" ]; then
|
||||
fn_print_fail "bzip2 is not installed"
|
||||
fn_script_log_fatal "bzip2 is not installed"
|
||||
core_exit.sh
|
||||
|
@ -25,7 +25,7 @@ else
|
||||
elif [ -z "${appid}" ]; then
|
||||
installer=1
|
||||
install_server_files.sh
|
||||
elif [ -n "${appid}" ]; then
|
||||
elif [ "${appid}" ]; then
|
||||
install_steamcmd.sh
|
||||
install_server_files.sh
|
||||
fi
|
||||
|
@ -82,7 +82,7 @@ fn_script_log_info "${modprettyname} selected for install"
|
||||
|
||||
# Check if the mod is already installed and warn the user.
|
||||
if [ -f "${modsinstalledlistfullpath}" ]; then
|
||||
if [ -n "$(sed -n "/^${modcommand}$/p" "${modsinstalledlistfullpath}")" ]; then
|
||||
if [ "$(sed -n "/^${modcommand}$/p" "${modsinstalledlistfullpath}")" ]; then
|
||||
fn_print_warning_nl "${modprettyname} is already installed"
|
||||
fn_script_log_warn "${modprettyname} is already installed"
|
||||
echo -e " * Any configs may be overwritten."
|
||||
|
@ -72,7 +72,7 @@ done
|
||||
installedmodsline="1"
|
||||
while [ "${installedmodsline}" -le "${installedmodscount}" ]; do
|
||||
currentmod=$(sed "${installedmodsline}q;d" "${modsinstalledlistfullpath}")
|
||||
if [ -n "${currentmod}" ]; then
|
||||
if [ "${currentmod}" ]; then
|
||||
fn_mod_get_info
|
||||
# Don not update mod if the policy is set to "NOUPDATE".
|
||||
if [ "${modkeepfiles}" == "NOUPDATE" ]; then
|
||||
|
@ -141,16 +141,16 @@ for queryattempt in {1..5}; do
|
||||
fi
|
||||
if [ "${querystatus}" == "0" ]; then
|
||||
# Add query data to log.
|
||||
if [ -n "${gdname}" ]; then
|
||||
if [ "${gdname}" ]; then
|
||||
fn_script_log_info "Server name: ${gdname}"
|
||||
fi
|
||||
if [ -n "${gdplayers}" ]; then
|
||||
if [ "${gdplayers}" ]; then
|
||||
fn_script_log_info "Players: ${gdplayers}/${gdmaxplayers}"
|
||||
fi
|
||||
if [ -n "${gdmap}" ]; then
|
||||
if [ "${gdmap}" ]; then
|
||||
fn_script_log_info "Map: ${gdmap}"
|
||||
fi
|
||||
if [ -n "${gdgamemode}" ]; then
|
||||
if [ "${gdgamemode}" ]; then
|
||||
fn_script_log_info "Game Mode: ${gdgamemode}"
|
||||
fi
|
||||
fi
|
||||
|
@ -48,7 +48,7 @@ if [ -f "${postdetailslog}" ]; then
|
||||
fi
|
||||
|
||||
# Rather than a one-pass sed parser, default to using a temporary directory.
|
||||
if [ -n "${exitbypass}" ]; then
|
||||
if [ "${exitbypass}" ]; then
|
||||
postdetailslog="${alertlog}"
|
||||
else
|
||||
# Run checks and gathers details to display.
|
||||
|
@ -10,7 +10,7 @@ local commandaction="Starting"
|
||||
local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
|
||||
|
||||
fn_start_teamspeak3(){
|
||||
if [ ! -e "${servercfgfullpath}" ]; then
|
||||
if [ ! -f "${servercfgfullpath}" ]; then
|
||||
fn_print_warn_nl "${servercfgfullpath} is missing"
|
||||
fn_script_log_warn "${servercfgfullpath} is missing"
|
||||
echo " * Creating blank ${servercfg}"
|
||||
@ -78,7 +78,7 @@ fn_start_tmux(){
|
||||
if [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then
|
||||
tmux pipe-pane -o -t "${selfname}" "exec cat >> '${consolelog}'"
|
||||
fi
|
||||
elif [ -n "${tmuxversion}" ]; then
|
||||
elif [ "${tmuxversion}" ]; then
|
||||
# Get the digit version of tmux.
|
||||
tmuxversion=$(tmux -V | sed "s/tmux //" | sed -n '1 p' | tr -cd '[:digit:]')
|
||||
# tmux pipe-pane not supported in tmux versions < 1.6.
|
||||
@ -176,7 +176,7 @@ if [ "${status}" != "0" ]; then
|
||||
core_exit.sh
|
||||
fi
|
||||
fi
|
||||
if [ -z "${fixbypass}" ];then
|
||||
if [ -z "${fixbypass}" ]; then
|
||||
fix.sh
|
||||
fi
|
||||
info_config.sh
|
||||
|
@ -134,22 +134,22 @@ fn_stop_graceful_sdtd(){
|
||||
fn_stop_graceful_sdtd_telnet
|
||||
completed=$(echo -en "\n ${sdtd_telnet_shutdown}" | grep "Completed.")
|
||||
refused=$(echo -en "\n ${sdtd_telnet_shutdown}" | grep "Timeout or EOF")
|
||||
if [ -n "${refused}" ]; then
|
||||
if [ "${refused}" ]; then
|
||||
fn_print_error "Graceful: telnet: ${telnetip}:${telnetport} : "
|
||||
fn_print_fail_eol_nl
|
||||
fn_script_log_error "Graceful: telnet: ${telnetip}:${telnetport} : FAIL"
|
||||
elif [ -n "${completed}" ]; then
|
||||
elif [ "${completed}" ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# If telnet shutdown was successful will use telnet again to check
|
||||
# the connection has closed, confirming that the tmux session can now be killed.
|
||||
if [ -n "${completed}" ]; then
|
||||
if [ "${completed}" ]; then
|
||||
for seconds in {1..30}; do
|
||||
fn_stop_graceful_sdtd_telnet
|
||||
refused=$(echo -en "\n ${sdtd_telnet_shutdown}" | grep "Timeout or EOF")
|
||||
if [ -n "${refused}" ]; then
|
||||
if [ "${refused}" ]; then
|
||||
fn_print_ok "Graceful: telnet: ${telnetip}:${telnetport} : "
|
||||
fn_print_ok_eol_nl
|
||||
fn_script_log_pass "Graceful: telnet: ${telnetip}:${telnetport} : ${seconds} seconds"
|
||||
@ -160,7 +160,7 @@ fn_stop_graceful_sdtd(){
|
||||
done
|
||||
# If telnet shutdown fails tmux shutdown will be used, this risks loss of world save.
|
||||
else
|
||||
if [ -n "${refused}" ]; then
|
||||
if [ "${refused}" ]; then
|
||||
fn_print_error "Graceful: telnet: "
|
||||
fn_print_fail_eol_nl
|
||||
fn_script_log_error "Graceful: telnet: ${telnetip}:${telnetport} : FAIL"
|
||||
|
@ -73,7 +73,7 @@ if [ -z "${legacymode}" ]; then
|
||||
fi
|
||||
|
||||
# Check and update functions.
|
||||
if [ -n "${functionsdir}" ]; then
|
||||
if [ "${functionsdir}" ]; then
|
||||
if [ -d "${functionsdir}" ]; then
|
||||
cd "${functionsdir}" || exit
|
||||
for functionfile in *
|
||||
|
@ -45,7 +45,7 @@ fn_wipe_server_remove_files(){
|
||||
# Rust Wipe.
|
||||
if [ "${shortname}" == "rust" ]; then
|
||||
# Wipe pocedural map.
|
||||
if [ -n "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.map")" ]; then
|
||||
if [ "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.map")" ]; then
|
||||
currentaction="Removing map file(s): ${serveridentitydir}/proceduralmap.*.map"
|
||||
echo -en "Removing procedural map proceduralmap.*.map file(s)..."
|
||||
fn_sleep_time
|
||||
@ -58,7 +58,7 @@ fn_wipe_server_remove_files(){
|
||||
fn_script_log_info "No procedural map file to remove."
|
||||
fi
|
||||
# Wipe procedural map save.
|
||||
if [ -n "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.sav")" ]; then
|
||||
if [ "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.sav")" ]; then
|
||||
currentaction="Removing procedural map save(s): ${serveridentitydir}/proceduralmap.*.sav"
|
||||
echo -en "Removing map saves proceduralmap.*.sav file(s)..."
|
||||
fn_sleep_time
|
||||
@ -71,7 +71,7 @@ fn_wipe_server_remove_files(){
|
||||
fn_script_log_info "No procedural map save to remove."
|
||||
fi
|
||||
# Wipe Barren map.
|
||||
if [ -n "$(find "${serveridentitydir}" -type f -name "barren*.map")" ]; then
|
||||
if [ "$(find "${serveridentitydir}" -type f -name "barren*.map")" ]; then
|
||||
currentaction="Removing map file(s): ${serveridentitydir}/barren*.map"
|
||||
echo -en "Removing barren map barren*.map file(s)..."
|
||||
fn_sleep_time
|
||||
@ -84,7 +84,7 @@ fn_wipe_server_remove_files(){
|
||||
fn_script_log_info "No barren map file to remove."
|
||||
fi
|
||||
# Wipe barren map save.
|
||||
if [ -n "$(find "${serveridentitydir}" -type f -name "barren*.sav")" ]; then
|
||||
if [ "$(find "${serveridentitydir}" -type f -name "barren*.sav")" ]; then
|
||||
currentaction="Removing barren map save(s): ${serveridentitydir}/barren*.sav"
|
||||
echo -en "Removing barren map saves barren*.sav file(s)..."
|
||||
fn_sleep_time
|
||||
@ -119,7 +119,7 @@ fn_wipe_server_remove_files(){
|
||||
# We do not print additional information if there is nothing to remove since this might be obsolete.
|
||||
fi
|
||||
# Wipe sv.files.
|
||||
if [ -n "$(find "${serveridentitydir}" -type f -name "sv.files.*.db")" ]; then
|
||||
if [ "$(find "${serveridentitydir}" -type f -name "sv.files.*.db")" ]; then
|
||||
currentaction="Removing server misc files: ${serveridentitydir}/sv.files.*.db"
|
||||
echo -en "Removing server misc srv.files*.db file(s)..."
|
||||
fn_sleep_time
|
||||
@ -130,7 +130,7 @@ fn_wipe_server_remove_files(){
|
||||
# No further information if not found because it should I could not get this file showing up.
|
||||
fi
|
||||
# Wipe player death files.
|
||||
if [ -n "$(find "${serveridentitydir}" -type f -name "player.deaths.*.db")" ]; then
|
||||
if [ "$(find "${serveridentitydir}" -type f -name "player.deaths.*.db")" ]; then
|
||||
currentaction="Removing player death files: ${serveridentitydir}/player.deaths.*.db"
|
||||
echo -en "Removing player deaths player.deaths.*.db file(s)..."
|
||||
fn_sleep_time
|
||||
@ -144,7 +144,7 @@ fn_wipe_server_remove_files(){
|
||||
fi
|
||||
# Wipe blueprints only if wipeall command was used.
|
||||
if [ "${wipeall}" == "1" ]; then
|
||||
if [ -n "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]; then
|
||||
if [ "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]; then
|
||||
currentaction="Removing blueprint file(s): ${serveridentitydir}/player.blueprints.*.db"
|
||||
echo -en "Removing blueprints player.blueprints.*.db file(s)..."
|
||||
fn_sleep_time
|
||||
@ -156,7 +156,7 @@ fn_wipe_server_remove_files(){
|
||||
fn_print_information_nl "No blueprint file to remove"
|
||||
fn_script_log_info "No blueprint file to remove."
|
||||
fi
|
||||
elif [ -n "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]; then
|
||||
elif [ "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]; then
|
||||
fn_print_information_nl "Keeping blueprints"
|
||||
fn_script_log_info "Keeping blueprints."
|
||||
else
|
||||
@ -165,7 +165,7 @@ fn_wipe_server_remove_files(){
|
||||
fn_sleep_time
|
||||
fi
|
||||
# Wipe some logs that might be there.
|
||||
if [ -n "$(find "${serveridentitydir}" -type f -name "Log.*.txt")" ]; then
|
||||
if [ "$(find "${serveridentitydir}" -type f -name "Log.*.txt")" ]; then
|
||||
currentaction="Removing log files: ${serveridentitydir}/Log.*.txt"
|
||||
echo -en "Removing Log files..."
|
||||
fn_sleep_time
|
||||
|
@ -256,7 +256,7 @@ fn_update_function(){
|
||||
}
|
||||
|
||||
# Check that curl is installed
|
||||
if [ -z "$(command -v curl 2>/dev/null)" ]; then
|
||||
if [ ! "$(command -v curl 2>/dev/null)" ]; then
|
||||
echo -e "[ FAIL ] Curl is not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -20,9 +20,9 @@ if [ "$(whoami)" == "root" ]; then
|
||||
find "${logdir}"/ -group root -prune -exec rm -rf {} + > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ -n "${exitbypass}" ]; then
|
||||
if [ "${exitbypass}" ]; then
|
||||
unset exitbypass
|
||||
elif [ -n "${exitcode}" ]&&[ "${exitcode}" != "0" ]; then
|
||||
elif [ "${exitcode}" ]&&[ "${exitcode}" != "0" ]; then
|
||||
if [ "${exitcode}" == "1" ]; then
|
||||
fn_script_log_fatal "${function_selfname} exiting with code: ${exitcode}"
|
||||
elif [ "${exitcode}" == "2" ]; then
|
||||
|
@ -64,13 +64,13 @@ currentopt+=( "${cmd_update_linuxgsm[@]}" )
|
||||
if [ "${engine}" != "quake" ]&&[ "${engine}" != "idtech2" ]&&[ "${engine}" != "idtech3" ]&&[ "${engine}" != "iw2.0" ]&&[ "${engine}" != "iw3.0" ]&&[ "${shortname}" != "bf1942" ]&&[ "${shortname}" != "samp" ]; then
|
||||
currentopt+=( "${cmd_update[@]}" )
|
||||
# force update for SteamCMD only or MTA.
|
||||
if [ -n "${appid}" ]||[ "${shortname}" == "mta" ]; then
|
||||
if [ "${appid}" ]||[ "${shortname}" == "mta" ]; then
|
||||
currentopt+=( "${cmd_force_update[@]}" )
|
||||
fi
|
||||
fi
|
||||
|
||||
# Validate command.
|
||||
if [ -n "${appid}" ]; then
|
||||
if [ "${appid}" ]; then
|
||||
currentopt+=( "${cmd_validate[@]}" )
|
||||
fi
|
||||
|
||||
|
@ -46,8 +46,8 @@ fn_sleep_time(){
|
||||
## Feb 28 14:56:58 ut99-server: Monitor:
|
||||
fn_script_log(){
|
||||
if [ -d "${lgsmlogdir}" ]; then
|
||||
if [ -n "${modulename}" ]; then
|
||||
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${servicename}: ${modulename}: ${1}" >> "${lgsmlog}"
|
||||
if [ "${modulename}" ]; then
|
||||
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: ${1}" >> "${lgsmlog}"
|
||||
else
|
||||
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${1}" >> "${lgsmlog}"
|
||||
fi
|
||||
@ -57,8 +57,9 @@ fn_script_log(){
|
||||
## Feb 28 14:56:58 ut99-server: Monitor: PASS:
|
||||
fn_script_log_pass(){
|
||||
if [ -d "${lgsmlogdir}" ]; then
|
||||
if [ -n "${modulename}" ]; then
|
||||
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${servicename}: ${modulename}: PASS: ${1}" >> "${lgsmlog}"
|
||||
|
||||
if [ "${modulename}" ]; then
|
||||
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: PASS: ${1}" >> "${lgsmlog}"
|
||||
else
|
||||
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: PASS: ${1}" >> "${lgsmlog}"
|
||||
fi
|
||||
@ -69,8 +70,8 @@ fn_script_log_pass(){
|
||||
## Feb 28 14:56:58 ut99-server: Monitor: FATAL:
|
||||
fn_script_log_fatal(){
|
||||
if [ -d "${lgsmlogdir}" ]; then
|
||||
if [ -n "${modulename}" ]; then
|
||||
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${servicename}: ${modulename}: FATAL: ${1}" >> "${lgsmlog}"
|
||||
if [ "${modulename}" ]; then
|
||||
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: FATAL: ${1}" >> "${lgsmlog}"
|
||||
else
|
||||
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: FATAL: ${1}" >> "${lgsmlog}"
|
||||
fi
|
||||
@ -81,8 +82,8 @@ fn_script_log_fatal(){
|
||||
## Feb 28 14:56:58 ut99-server: Monitor: ERROR:
|
||||
fn_script_log_error(){
|
||||
if [ -d "${lgsmlogdir}" ]; then
|
||||
if [ -n "${modulename}" ]; then
|
||||
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${servicename}: ${modulename}: ERROR: ${1}" >> "${lgsmlog}"
|
||||
if [ "${modulename}" ]; then
|
||||
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: ERROR: ${1}" >> "${lgsmlog}"
|
||||
else
|
||||
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ERROR: ${1}" >> "${lgsmlog}"
|
||||
fi
|
||||
@ -93,8 +94,8 @@ fn_script_log_error(){
|
||||
## Feb 28 14:56:58 ut99-server: Monitor: WARN:
|
||||
fn_script_log_warn(){
|
||||
if [ -d "${lgsmlogdir}" ]; then
|
||||
if [ -n "${modulename}" ]; then
|
||||
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${servicename}: ${modulename}: WARN: ${1}" >> "${lgsmlog}"
|
||||
if [ "${modulename}" ]; then
|
||||
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: WARN: ${1}" >> "${lgsmlog}"
|
||||
else
|
||||
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: WARN: ${1}" >> "${lgsmlog}"
|
||||
fi
|
||||
@ -105,8 +106,8 @@ fn_script_log_warn(){
|
||||
## Feb 28 14:56:58 ut99-server: Monitor: INFO:
|
||||
fn_script_log_info(){
|
||||
if [ -d "${lgsmlogdir}" ]; then
|
||||
if [ -n "${modulename}" ]; then
|
||||
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${servicename}: ${modulename}: INFO: ${1}" >> "${lgsmlog}"
|
||||
if [ "${modulename}" ]; then
|
||||
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: ${commandname}: INFO: ${1}" >> "${lgsmlog}"
|
||||
else
|
||||
echo -e "$(date '+%b %d %H:%M:%S.%3N') ${selfname}: INFO: ${1}" >> "${lgsmlog}"
|
||||
fi
|
||||
@ -118,7 +119,7 @@ fn_script_log_info(){
|
||||
|
||||
# [ .... ]
|
||||
fn_print_dots(){
|
||||
if [ -n "${commandaction}" ]; then
|
||||
if [ "${commandaction}" ]; then
|
||||
echo -en "${creeol}[ .... ] ${commandaction} ${selfname}: $*"
|
||||
else
|
||||
echo -en "${creeol}[ .... ] $*"
|
||||
@ -127,7 +128,7 @@ fn_print_dots(){
|
||||
}
|
||||
|
||||
fn_print_dots_nl(){
|
||||
if [ -n "${commandaction}" ]; then
|
||||
if [ "${commandaction}" ]; then
|
||||
echo -e "${creeol}[ .... ] ${commandaction} ${selfname}: $*"
|
||||
else
|
||||
echo -e "${creeol}[ .... ] $*"
|
||||
@ -138,7 +139,7 @@ fn_print_dots_nl(){
|
||||
|
||||
# [ OK ]
|
||||
fn_print_ok(){
|
||||
if [ -n "${commandaction}" ]; then
|
||||
if [ "${commandaction}" ]; then
|
||||
echo -en "${creeol}[${green} OK ${default}] ${commandaction} ${selfname}: $*"
|
||||
else
|
||||
echo -en "${creeol}[${green} OK ${default}] $*"
|
||||
@ -147,7 +148,7 @@ fn_print_ok(){
|
||||
}
|
||||
|
||||
fn_print_ok_nl(){
|
||||
if [ -n "${commandaction}" ]; then
|
||||
if [ "${commandaction}" ]; then
|
||||
echo -en "${creeol}[${green} OK ${default}] ${commandaction} ${selfname}: $*"
|
||||
else
|
||||
echo -en "${creeol}[${green} OK ${default}] $*"
|
||||
@ -158,7 +159,7 @@ fn_print_ok_nl(){
|
||||
|
||||
# [ FAIL ]
|
||||
fn_print_fail(){
|
||||
if [ -n "${commandaction}" ]; then
|
||||
if [ "${commandaction}" ]; then
|
||||
echo -en "${creeol}[${red} FAIL ${default}] ${commandaction} ${selfname}: $*"
|
||||
else
|
||||
echo -en "${creeol}[${red} FAIL ${default}] $*"
|
||||
@ -167,7 +168,7 @@ fn_print_fail(){
|
||||
}
|
||||
|
||||
fn_print_fail_nl(){
|
||||
if [ -n "${commandaction}" ]; then
|
||||
if [ "${commandaction}" ]; then
|
||||
echo -en "${creeol}[${red} FAIL ${default}] ${commandaction} ${selfname}: $*"
|
||||
else
|
||||
echo -en "${creeol}[${red} FAIL ${default}] $*"
|
||||
@ -178,7 +179,7 @@ fn_print_fail_nl(){
|
||||
|
||||
# [ ERROR ]
|
||||
fn_print_error(){
|
||||
if [ -n "${commandaction}" ]; then
|
||||
if [ "${commandaction}" ]; then
|
||||
echo -en "${creeol}[${red}ERROR ${default}] ${commandaction} ${selfname}: $*"
|
||||
else
|
||||
echo -en "${creeol}[${red}ERROR ${default}] $*"
|
||||
@ -187,7 +188,7 @@ fn_print_error(){
|
||||
}
|
||||
|
||||
fn_print_error_nl(){
|
||||
if [ -n "${commandaction}" ]; then
|
||||
if [ "${commandaction}" ]; then
|
||||
echo -en "${creeol}[${red}ERROR ${default}] ${commandaction} ${selfname}: $*"
|
||||
else
|
||||
echo -en "${creeol}[${red}ERROR ${default}] $*"
|
||||
@ -198,7 +199,7 @@ fn_print_error_nl(){
|
||||
|
||||
# [ WARN ]
|
||||
fn_print_warn(){
|
||||
if [ -n "${commandaction}" ]; then
|
||||
if [ "${commandaction}" ]; then
|
||||
echo -en "${creeol}[${lightyellow} WARN ${default}] ${commandaction} ${selfname}: $*"
|
||||
else
|
||||
echo -en "${creeol}[${lightyellow} WARN ${default}] $*"
|
||||
@ -207,7 +208,7 @@ fn_print_warn(){
|
||||
}
|
||||
|
||||
fn_print_warn_nl(){
|
||||
if [ -n "${commandaction}" ]; then
|
||||
if [ "${commandaction}" ]; then
|
||||
echo -en "${creeol}[${lightyellow} WARN ${default}] ${commandaction} ${selfname}: $*"
|
||||
else
|
||||
echo -en "${creeol}[${lightyellow} WARN ${default}] $*"
|
||||
@ -218,7 +219,7 @@ fn_print_warn_nl(){
|
||||
|
||||
# [ INFO ]
|
||||
fn_print_info(){
|
||||
if [ -n "${commandaction}" ]; then
|
||||
if [ "${commandaction}" ]; then
|
||||
echo -en "${creeol}[${cyan} INFO ${default}] ${commandaction} ${selfname}: $*"
|
||||
else
|
||||
echo -en "${creeol}[${cyan} INFO ${default}] $*"
|
||||
@ -227,7 +228,7 @@ fn_print_info(){
|
||||
}
|
||||
|
||||
fn_print_info_nl(){
|
||||
if [ -n "${commandaction}" ]; then
|
||||
if [ "${commandaction}" ]; then
|
||||
echo -en "${creeol}[${cyan} INFO ${default}] ${commandaction} ${selfname}: $*"
|
||||
else
|
||||
echo -en "${creeol}[${cyan} INFO ${default}] $*"
|
||||
|
@ -33,7 +33,7 @@ fn_fix_msg_end(){
|
||||
|
||||
# Fixes that are run on start.
|
||||
if [ "${function_selfname}" != "command_install.sh" ]&&[ -z "${fixbypass}" ]; then
|
||||
if [ -n "${appid}" ]; then
|
||||
if [ "${appid}" ]; then
|
||||
fix_steamcmd.sh
|
||||
fi
|
||||
|
||||
|
@ -35,11 +35,11 @@ do
|
||||
elif [ "$(command -v lsb_release 2>/dev/null)" ]&&[ "${distro_info}" == "lsb_release" ]; then
|
||||
if [ -z "${distroname}" ];then
|
||||
distroname=$(lsb_release -sd)
|
||||
elif [ -z "${distroversion}" ];then
|
||||
elif [ -z "${distroversion}" ]; then
|
||||
distroversion=$(lsb_release -sr)
|
||||
elif [ -z "${distroid}" ];then
|
||||
elif [ -z "${distroid}" ]; then
|
||||
distroid=$(lsb_release -si)
|
||||
elif [ -z "${distrocodename}" ];then
|
||||
elif [ -z "${distrocodename}" ]; then
|
||||
distrocodename=$(lsb_release -sc)
|
||||
fi
|
||||
elif [ "$(command -v hostnamectl 2>/dev/null)" ]&&[ "${distro_info}" == "hostnamectl" ]; then
|
||||
@ -47,19 +47,19 @@ do
|
||||
distroname=$(hostnamectl | grep "Operating System" | sed 's/Operating System: //g')
|
||||
fi
|
||||
elif [ -f "/etc/debian_version" ]&&[ "${distro_info}" == "debian_version" ]; then
|
||||
if [ -z "${distroname}" ];then
|
||||
if [ -z "${distroname}" ]; then
|
||||
distroname="Debian $(cat /etc/debian_version)"
|
||||
elif [ -z "${distroversion}" ];then
|
||||
elif [ -z "${distroversion}" ]; then
|
||||
distroversion=$(cat /etc/debian_version)
|
||||
elif [ -z "${distroid}" ];then
|
||||
elif [ -z "${distroid}" ]; then
|
||||
distroid="debian"
|
||||
fi
|
||||
elif [ -f "/etc/redhat-release" ]&&[ "${distro_info}" == "redhat-release" ]; then
|
||||
if [ -z "${distroname}" ];then
|
||||
if [ -z "${distroname}" ]; then
|
||||
distroname=$(cat /etc/redhat-release)
|
||||
elif [ -z "${distroversion}" ];then
|
||||
elif [ -z "${distroversion}" ]; then
|
||||
distroversion=$(rpm -qa \*-release | grep -Ei "oracle|redhat|centos|fedora" | cut -d"-" -f3)
|
||||
elif [ -z "${distroid}" ];then
|
||||
elif [ -z "${distroid}" ]; then
|
||||
distroid=$(awk '{print $1}' /etc/redhat-release)
|
||||
fi
|
||||
fi
|
||||
@ -71,7 +71,7 @@ glibcversion=$(ldd --version | sed -n '1s/.* //p')
|
||||
|
||||
## tmux version
|
||||
# e.g: tmux 1.6
|
||||
if [ -z "$(command -V tmux 2>/dev/null)" ]; then
|
||||
if [ ! "$(command -V tmux 2>/dev/null)" ]; then
|
||||
tmuxv="${red}NOT INSTALLED!${default}"
|
||||
else
|
||||
if [ "$(tmux -V | sed "s/tmux //" | sed -n '1 p' | tr -cd '[:digit:]')" -lt "16" ]; then
|
||||
@ -156,7 +156,7 @@ else
|
||||
physmemused=$(free ${humanreadable} | awk '/Mem:/ {print $3}')
|
||||
|
||||
oldfree=$(free ${humanreadable} | awk '/cache:/')
|
||||
if [ -n "${oldfree}" ]; then
|
||||
if [ "${oldfree}" ]; then
|
||||
physmemavailable="n/a"
|
||||
physmemcached="n/a"
|
||||
else
|
||||
@ -277,7 +277,7 @@ if [ "$(command -v jq 2>/dev/null)" ]; then
|
||||
fi
|
||||
|
||||
# Sets the SteamCMD glibc requirement if the game server requirement is less or not required.
|
||||
if [ -n "${appid}" ]; then
|
||||
if [ "${appid}" ]; then
|
||||
if [ "${glibc}" = "null" ]||[ -z "${glibc}" ]||[ "$(printf '%s\n'${glibc}'\n' "2.14" | sort -V | head -n 1)" != "2.14" ]; then
|
||||
glibc="2.14"
|
||||
fi
|
||||
|
@ -174,19 +174,19 @@ fn_info_message_gameserver(){
|
||||
fn_messages_separator
|
||||
{
|
||||
# Server name
|
||||
if [ -n "${gdname}" ]; then
|
||||
if [ "${gdname}" ]; then
|
||||
echo -e "${lightblue}Server name:\t${default}${gdname}"
|
||||
elif [ -n "${servername}" ]; then
|
||||
elif [ "${servername}" ]; then
|
||||
echo -e "${lightblue}Server name:\t${default}${servername}"
|
||||
fi
|
||||
|
||||
# Server description
|
||||
if [ -n "${serverdescription}" ]; then
|
||||
if [ "${serverdescription}" ]; then
|
||||
echo -e "${lightblue}Server Description:\t${default}${serverdescription}"
|
||||
fi
|
||||
|
||||
# Branch
|
||||
if [ -n "${branch}" ]; then
|
||||
if [ "${branch}" ]; then
|
||||
echo -e "${lightblue}Branch:\t${default}${branch}"
|
||||
fi
|
||||
|
||||
@ -198,68 +198,68 @@ fn_info_message_gameserver(){
|
||||
fi
|
||||
|
||||
# Internet ip
|
||||
if [ -n "${extip}" ]; then
|
||||
if [ "${extip}" ]; then
|
||||
if [ "${ip}" != "${extip}" ]; then
|
||||
echo -e "${lightblue}Internet IP:\t${default}${extip}:${port}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Display ip
|
||||
if [ -n "${displayip}" ]; then
|
||||
if [ "${displayip}" ]; then
|
||||
echo -e "${lightblue}Display IP:\t${default}${displayip}:${port}"
|
||||
fi
|
||||
|
||||
# Server password
|
||||
if [ -n "${serverpassword}" ]; then
|
||||
if [ "${serverpassword}" ]; then
|
||||
echo -e "${lightblue}Server password:\t${default}${serverpassword}"
|
||||
fi
|
||||
|
||||
# Query enabled (Starbound)
|
||||
if [ -n "${queryenabled}" ]; then
|
||||
if [ "${queryenabled}" ]; then
|
||||
echo -e "${lightblue}Query enabled:\t${default}${queryenabled}"
|
||||
fi
|
||||
|
||||
# RCON enabled (Starbound)
|
||||
if [ -n "${rconenabled}" ]; then
|
||||
if [ "${rconenabled}" ]; then
|
||||
echo -e "${lightblue}RCON enabled:\t${default}${rconpassword}"
|
||||
fi
|
||||
|
||||
# RCON password
|
||||
if [ -n "${rconpassword}" ]; then
|
||||
if [ "${rconpassword}" ]; then
|
||||
echo -e "${lightblue}RCON password:\t${default}${rconpassword}"
|
||||
fi
|
||||
|
||||
# RCON web (Rust)
|
||||
if [ -n "${rconweb}" ]; then
|
||||
if [ "${rconweb}" ]; then
|
||||
echo -e "${lightblue}RCON web:\t${default}${rconweb}"
|
||||
fi
|
||||
|
||||
# Admin password
|
||||
if [ -n "${adminpassword}" ]; then
|
||||
if [ "${adminpassword}" ]; then
|
||||
echo -e "${lightblue}Admin password:\t${default}${adminpassword}"
|
||||
fi
|
||||
|
||||
# Stats password (Quake Live)
|
||||
if [ -n "${statspassword}" ]; then
|
||||
if [ "${statspassword}" ]; then
|
||||
echo -e "${lightblue}Stats password:\t${default}${statspassword}"
|
||||
fi
|
||||
|
||||
# Players
|
||||
if [ "${querystatus}" != "0" ]; then
|
||||
if [ -n "${maxplayers}" ]; then
|
||||
if [ "${maxplayers}" ]; then
|
||||
echo -e "${lightblue}Maxplayers:\t${default}${maxplayers}"
|
||||
fi
|
||||
else
|
||||
if [ -n "${gdplayers}" ]&&[ -n "${gdmaxplayers}" ]; then
|
||||
if [ "${gdplayers}" ]&&[ -n "${gdmaxplayers}" ]; then
|
||||
echo -e "${lightblue}Players:\t${default}${gdplayers}/${gdmaxplayers}"
|
||||
|
||||
elif [ -n "${gdplayers}" ]&&[ -n "${maxplayers}" ]; then
|
||||
elif [ "${gdplayers}" ]&&[ -n "${maxplayers}" ]; then
|
||||
echo -e "${lightblue}Players:\t${default}${gdplayers}/${maxplayers}"
|
||||
|
||||
elif [ -z "${gdplayers}" ]&&[ -n "${gdmaxplayers}" ]; then
|
||||
echo -e "${lightblue}Players:\t${default}0/${gdmaxplayers}"
|
||||
|
||||
elif [ -n "${gdplayers}" ]&&[ -z "${gdmaxplayers}" ]; then
|
||||
elif [ "${gdplayers}" ]&&[ -z "${gdmaxplayers}" ]; then
|
||||
echo -e "${lightblue}Players:\t${default}${gdplayers}|∞"
|
||||
|
||||
elif [ -z "${gdplayers}" ]&&[ -z "${gdmaxplayers}" ]&&[ -n "${maxplayers}" ]; then
|
||||
@ -268,110 +268,110 @@ fn_info_message_gameserver(){
|
||||
fi
|
||||
|
||||
# Bots
|
||||
if [ -n "${gdbots}" ]; then
|
||||
if [ "${gdbots}" ]; then
|
||||
echo -e "${lightblue}Bots:\t${default}${gdbots}"
|
||||
fi
|
||||
|
||||
# Current map
|
||||
if [ -n "${gdmap}" ]; then
|
||||
if [ "${gdmap}" ]; then
|
||||
echo -e "${lightblue}Current map:\t${default}${gdmap}"
|
||||
fi
|
||||
|
||||
# Default map
|
||||
if [ -n "${defaultmap}" ]; then
|
||||
if [ "${defaultmap}" ]; then
|
||||
echo -e "${lightblue}Default map:\t${default}${defaultmap}"
|
||||
fi
|
||||
|
||||
if [ -n "${defaultscenario}" ]; then
|
||||
if [ "${defaultscenario}" ]; then
|
||||
# Current scenario
|
||||
if [ -n "${gdgamemode}" ]; then
|
||||
if [ "${gdgamemode}" ]; then
|
||||
echo -e "${lightblue}Current scenario:\t${default}${gdgamemode}"
|
||||
fi
|
||||
else
|
||||
# Current game mode
|
||||
if [ -n "${gdgamemode}" ]; then
|
||||
if [ "${gdgamemode}" ]; then
|
||||
echo -e "${lightblue}Current game mode:\t${default}${gdgamemode}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Default scenario
|
||||
if [ -n "${defaultscenario}" ]; then
|
||||
if [ "${defaultscenario}" ]; then
|
||||
echo -e "${lightblue}Default scenario:\t${default}${defaultscenario}"
|
||||
fi
|
||||
|
||||
# Game type
|
||||
if [ -n "${gametype}" ]; then
|
||||
if [ "${gametype}" ]; then
|
||||
echo -e "${lightblue}Game type:\t${default}${gametype}"
|
||||
fi
|
||||
|
||||
# Game mode
|
||||
if [ -n "${gamemode}" ]; then
|
||||
if [ "${gamemode}" ]; then
|
||||
echo -e "${lightblue}Game mode:\t${default}${gamemode}"
|
||||
fi
|
||||
|
||||
# Game world
|
||||
if [ -n "${gameworld}" ]; then
|
||||
if [ "${gameworld}" ]; then
|
||||
echo -e "${lightblue}Game world:\t${default}${gameworld}"
|
||||
fi
|
||||
|
||||
# Tick rate
|
||||
if [ -n "${tickrate}" ]; then
|
||||
if [ "${tickrate}" ]; then
|
||||
echo -e "${lightblue}Tick rate:\t${default}${tickrate}"
|
||||
fi
|
||||
|
||||
# Sharding (Don't Starve Together)
|
||||
if [ -n "${sharding}" ]; then
|
||||
if [ "${sharding}" ]; then
|
||||
echo -e "${lightblue}Sharding:\t${default}${sharding}"
|
||||
fi
|
||||
|
||||
# Master (Don't Starve Together)
|
||||
if [ -n "${master}" ]; then
|
||||
if [ "${master}" ]; then
|
||||
echo -e "${lightblue}Master:\t${default}${master}"
|
||||
fi
|
||||
|
||||
# Shard (Don't Starve Together)
|
||||
if [ -n "${shard}" ]; then
|
||||
if [ "${shard}" ]; then
|
||||
echo -e "${lightblue}Shard:\t${default}${shard}"
|
||||
fi
|
||||
|
||||
# Cluster (Don't Starve Together)
|
||||
if [ -n "${cluster}" ]; then
|
||||
if [ "${cluster}" ]; then
|
||||
echo -e "${lightblue}Cluster:\t${default}${cluster}"
|
||||
fi
|
||||
|
||||
# Cave (Don't Starve Together)
|
||||
if [ -n "${cave}" ]; then
|
||||
if [ "${cave}" ]; then
|
||||
echo -e "${lightblue}Cave:\t${default}${cave}"
|
||||
fi
|
||||
|
||||
# Creativemode (Hurtworld)
|
||||
if [ -n "${creativemode}" ]; then
|
||||
if [ "${creativemode}" ]; then
|
||||
echo -e "${lightblue}Creativemode:\t${default}${creativemode}"
|
||||
fi
|
||||
|
||||
# TeamSpeak dbplugin
|
||||
if [ -n "${dbplugin}" ]; then
|
||||
if [ "${dbplugin}" ]; then
|
||||
echo -e "${lightblue}dbplugin:\t${default}${dbplugin}"
|
||||
fi
|
||||
|
||||
# ASE (Multi Theft Auto)
|
||||
if [ -n "${ase}" ]; then
|
||||
if [ "${ase}" ]; then
|
||||
echo -e "${lightblue}ASE:\t${default}${ase}"
|
||||
fi
|
||||
|
||||
# Save interval (Rust)
|
||||
if [ -n "${saveinterval}" ]; then
|
||||
if [ "${saveinterval}" ]; then
|
||||
echo -e "${lightblue}ASE:\t${default}${saveinterval} s"
|
||||
fi
|
||||
|
||||
# Random map rotation mode (Squad and Post Scriptum)
|
||||
if [ -n "${randommap}" ]; then
|
||||
if [ "${randommap}" ]; then
|
||||
echo -e "${lightblue}Map rotation:\t${default}${randommap}"
|
||||
fi
|
||||
|
||||
# Listed on Master server
|
||||
if [ -n "${displaymasterserver}" ];then
|
||||
if [ "${displaymasterserver}" == "true" ];then
|
||||
if [ "${displaymasterserver}" ]; then
|
||||
if [ "${displaymasterserver}" == "true" ]; then
|
||||
echo -e "${lightblue}Master server:\t${green}${displaymasterserver}${default}"
|
||||
else
|
||||
echo -e "${lightblue}Master server:\t${red}${displaymasterserver}${default}"
|
||||
@ -416,12 +416,12 @@ fn_info_message_script(){
|
||||
echo -e "${lightblue}Script name:\t${default}${selfname}"
|
||||
|
||||
# LinuxGSM version
|
||||
if [ -n "${version}" ]; then
|
||||
if [ "${version}" ]; then
|
||||
echo -e "${lightblue}LinuxGSM version:\t${default}${version}"
|
||||
fi
|
||||
|
||||
# glibc required
|
||||
if [ -n "${glibc}" ]; then
|
||||
if [ "${glibc}" ]; then
|
||||
if [ "${glibc}" == "null" ]; then
|
||||
# Glibc is not required.
|
||||
:
|
||||
@ -451,7 +451,7 @@ fn_info_message_script(){
|
||||
# Telegram alert
|
||||
echo -e "${lightblue}Telegram alert:\t${default}${telegramalert}"
|
||||
# Update on start
|
||||
if [ -n "${updateonstart}" ]; then
|
||||
if [ "${updateonstart}" ]; then
|
||||
echo -e "${lightblue}Update on start:\t${default}${updateonstart}"
|
||||
fi
|
||||
|
||||
@ -462,7 +462,7 @@ fn_info_message_script(){
|
||||
echo -e "${lightblue}Location:\t${default}${rootdir}"
|
||||
|
||||
# Config file location
|
||||
if [ -n "${servercfgfullpath}" ]; then
|
||||
if [ "${servercfgfullpath}" ]; then
|
||||
if [ -f "${servercfgfullpath}" ]; then
|
||||
echo -e "${lightblue}Config file:\t${default}${servercfgfullpath}"
|
||||
elif [ -d "${servercfgfullpath}" ]; then
|
||||
@ -473,7 +473,7 @@ fn_info_message_script(){
|
||||
fi
|
||||
|
||||
# Network config file location (ARMA 3)
|
||||
if [ -n "${networkcfgfullpath}" ]; then
|
||||
if [ "${networkcfgfullpath}" ]; then
|
||||
echo -e "${lightblue}Network config file:\t${default}${networkcfgfullpath}"
|
||||
fi
|
||||
} | column -s $'\t' -t
|
||||
@ -580,7 +580,7 @@ fn_info_logs(){
|
||||
echo -e "${selfname} Logs"
|
||||
echo -e "================================="
|
||||
|
||||
if [ -n "${lgsmlog}" ]; then
|
||||
if [ "${lgsmlog}" ]; then
|
||||
echo -e "\nScript log\n==================="
|
||||
if [ ! "$(ls -A "${lgsmlogdir}")" ]; then
|
||||
echo -e "${lgsmlogdir} (NO LOG FILES)"
|
||||
@ -593,7 +593,7 @@ fn_info_logs(){
|
||||
echo -e ""
|
||||
fi
|
||||
|
||||
if [ -n "${consolelog}" ]; then
|
||||
if [ "${consolelog}" ]; then
|
||||
echo -e "\nConsole log\n===================="
|
||||
if [ ! "$(ls -A "${consolelogdir}")" ]; then
|
||||
echo -e "${consolelogdir} (NO LOG FILES)"
|
||||
@ -606,7 +606,7 @@ fn_info_logs(){
|
||||
echo -e ""
|
||||
fi
|
||||
|
||||
if [ -n "${gamelogdir}" ]; then
|
||||
if [ "${gamelogdir}" ]; then
|
||||
echo -e "\nServer log\n==================="
|
||||
if [ ! "$(ls -A "${gamelogdir}")" ]; then
|
||||
echo -e "${gamelogdir} (NO LOG FILES)"
|
||||
@ -1497,35 +1497,35 @@ fn_messages_separator(){
|
||||
# Removes the passwords form all but details
|
||||
fn_info_message_password_strip(){
|
||||
if [ "${function_selfname}" != "command_details.sh" ]; then
|
||||
if [ -n "${serverpassword}" ]; then
|
||||
if [ "${serverpassword}" ]; then
|
||||
serverpassword="********"
|
||||
fi
|
||||
|
||||
if [ -n "${rconpassword}" ]; then
|
||||
if [ "${rconpassword}" ]; then
|
||||
rconpassword="********"
|
||||
fi
|
||||
|
||||
if [ -n "${adminpassword}" ]; then
|
||||
if [ "${adminpassword}" ]; then
|
||||
adminpassword="********"
|
||||
fi
|
||||
|
||||
if [ -n "${statspassword}" ]; then
|
||||
if [ "${statspassword}" ]; then
|
||||
statspassword="********"
|
||||
fi
|
||||
|
||||
if [ -n "${webadminpass}" ]; then
|
||||
if [ "${webadminpass}" ]; then
|
||||
webadminpass="********"
|
||||
fi
|
||||
|
||||
if [ -n "${telnetpass}" ]; then
|
||||
if [ "${telnetpass}" ]; then
|
||||
telnetpass="********"
|
||||
fi
|
||||
|
||||
if [ -n "${wsapikey}" ]; then
|
||||
if [ "${wsapikey}" ]; then
|
||||
wsapikey="********"
|
||||
fi
|
||||
|
||||
if [ -n "${gslt}" ]; then
|
||||
if [ "${gslt}" ]; then
|
||||
gslt="********"
|
||||
fi
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
info_distro.sh
|
||||
# generate uuid
|
||||
if [ ! -f "${datadir}/uuid.txt" ];then
|
||||
if [ ! -f "${datadir}/uuid.txt" ]; then
|
||||
mkdir -p "${datadir}"
|
||||
touch "${datadir}/uuid.txt"
|
||||
if [ "$(command -v uuidgen 2>/dev/null)" ]; then
|
||||
|
@ -41,7 +41,7 @@ else
|
||||
fn_print_ok_eol_nl
|
||||
fi
|
||||
# Create Console logs.
|
||||
if [ -n "${consolelogdir}" ]; then
|
||||
if [ "${consolelogdir}" ]; then
|
||||
echo -en "installing console log dir: ${consolelogdir}..."
|
||||
mkdir -p "${consolelogdir}"
|
||||
if [ $? -ne 0 ]; then
|
||||
@ -60,7 +60,7 @@ if [ -n "${consolelogdir}" ]; then
|
||||
fi
|
||||
|
||||
# Create Game logs.
|
||||
if [ -n "${gamelogdir}" ]&&[ ! -d "${gamelogdir}" ]; then
|
||||
if [ "${gamelogdir}" ]&&[ ! -d "${gamelogdir}" ]; then
|
||||
echo -en "installing game log dir: ${gamelogdir}..."
|
||||
if ! mkdir -p "${gamelogdir}"; then
|
||||
fn_print_fail_eol_nl
|
||||
@ -74,7 +74,7 @@ fi
|
||||
# unless gamelogdir is within logdir.
|
||||
# e.g serverfiles/log is not within log/: symlink created
|
||||
# log/server is in log/: symlink not created
|
||||
if [ -n "${gamelogdir}" ]; then
|
||||
if [ "${gamelogdir}" ]; then
|
||||
if [ "${gamelogdir:0:${#logdir}}" != "${logdir}" ]; then
|
||||
echo -en "creating symlink to game log dir: ${logdir}/server -> ${gamelogdir}..."
|
||||
if ! ln -nfs "${gamelogdir}" "${logdir}/server"; then
|
||||
|
@ -146,7 +146,7 @@ echo -e "${lightyellow}Installing ${gamename} Server${default}"
|
||||
echo -e "================================="
|
||||
fn_sleep_time
|
||||
|
||||
if [ -n "${appid}" ]; then
|
||||
if [ "${appid}" ]; then
|
||||
fn_install_server_files_steamcmd
|
||||
fi
|
||||
|
||||
|
@ -9,8 +9,8 @@ local modulename="LOGS"
|
||||
local commandaction="Log-Manager"
|
||||
|
||||
# Check if logfile variable and file exist, create logfile if it doesn't exist.
|
||||
if [ -n "${consolelog}" ]; then
|
||||
if [ ! -e "${consolelog}" ]; then
|
||||
if [ "${consolelog}" ]; then
|
||||
if [ ! -f "${consolelog}" ]; then
|
||||
touch "${consolelog}"
|
||||
fi
|
||||
fi
|
||||
@ -18,7 +18,7 @@ fi
|
||||
# For games not displaying a console, and having logs into their game directory.
|
||||
check_status.sh
|
||||
if [ "${status}" != "0" ]&&[ "${function_selfname}" == "command_start.sh" ]&&[ -n "${gamelogfile}" ]; then
|
||||
if [ -n "$(find "${systemdir}" -name "gamelog*.log")" ]; then
|
||||
if [ "$(find "${systemdir}" -name "gamelog*.log")" ]; then
|
||||
fn_print_info "Moving game logs to ${gamelogdir}"
|
||||
fn_script_log_info "Moving game logs to ${gamelogdir}"
|
||||
echo -en "\n"
|
||||
@ -56,7 +56,7 @@ if [ "$(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l)" -ne "0" ];
|
||||
find "${gamelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
|
||||
fi
|
||||
# Console logfiles.
|
||||
if [ -n "${consolelog}" ]; then
|
||||
if [ "${consolelog}" ]; then
|
||||
find "${consolelogdir}"/ -type f -mtime +"${logdays}" | tee >> "${lgsmlog}"
|
||||
consolecount=$(find "${consolelogdir}"/ -type f -mtime +"${logdays}" | wc -l)
|
||||
find "${consolelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
|
||||
|
@ -104,7 +104,7 @@ fn_mod_copy_destination(){
|
||||
|
||||
# Add the mod to the installed-mods.txt.
|
||||
fn_mod_add_list(){
|
||||
if [ ! -n "$(sed -n "/^${modcommand}$/p" "${modsinstalledlistfullpath}")" ]; then
|
||||
if [ -z "$(sed -n "/^${modcommand}$/p" "${modsinstalledlistfullpath}")" ]; then
|
||||
echo -e "${modcommand}" >> "${modsinstalledlistfullpath}"
|
||||
fn_script_log_info "${modcommand} added to ${modsinstalledlist}"
|
||||
fi
|
||||
@ -267,7 +267,7 @@ fn_mods_installed_list(){
|
||||
# Increment line check.
|
||||
((installedmodsline++))
|
||||
done
|
||||
if [ -n "${installedmodscount}" ]; then
|
||||
if [ "${installedmodscount}" ]; then
|
||||
fn_script_log_info "${installedmodscount} addons/mods are currently installed"
|
||||
fi
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ fn_install_menu_bash() {
|
||||
done < "${options}"
|
||||
menu_options+=( "Cancel" )
|
||||
select option in "${menu_options[@]}"; do
|
||||
if [ -n "${option}" ]&&[ "${option}" != "Cancel" ]; then
|
||||
if [ "${option}" ]&&[ "${option}" != "Cancel" ]; then
|
||||
eval "$resultvar=\"${option/%\ */}\""
|
||||
fi
|
||||
break
|
||||
@ -297,7 +297,7 @@ if [ "${shortname}" == "core" ]; then
|
||||
echo -e "result: ${result}"
|
||||
echo -e "gameservername: ${gameservername}"
|
||||
fi
|
||||
elif [ -n "${userinput}" ]; then
|
||||
elif [ "${userinput}" ]; then
|
||||
fn_server_info
|
||||
if [ "${userinput}" == "${gameservername}" ]||[ "${userinput}" == "${gamename}" ]||[ "${userinput}" == "${shortname}" ]; then
|
||||
fn_install_file
|
||||
|
@ -160,7 +160,7 @@ fn_install_menu_bash() {
|
||||
done < "${options}"
|
||||
menu_options+=( "Cancel" )
|
||||
select option in "${menu_options[@]}"; do
|
||||
if [ -n "${option}" ]&&[ "${option}" != "Cancel" ]; then
|
||||
if [ "${option}" ]&&[ "${option}" != "Cancel" ]; then
|
||||
eval "$resultvar=\"${option/%\ */}\""
|
||||
fi
|
||||
break
|
||||
@ -306,7 +306,7 @@ if [ "${shortname}" == "core" ]; then
|
||||
echo -e "result: ${result}"
|
||||
echo -e "gameservername: ${gameservername}"
|
||||
fi
|
||||
elif [ -n "${userinput}" ]; then
|
||||
elif [ "${userinput}" ]; then
|
||||
fn_server_info
|
||||
if [ "${userinput}" == "${gameservername}" ]||[ "${userinput}" == "${gamename}" ]||[ "${userinput}" == "${shortname}" ]; then
|
||||
fn_install_file
|
||||
|
@ -160,7 +160,7 @@ fn_install_menu_bash() {
|
||||
done < "${options}"
|
||||
menu_options+=( "Cancel" )
|
||||
select option in "${menu_options[@]}"; do
|
||||
if [ -n "${option}" ]&&[ "${option}" != "Cancel" ]; then
|
||||
if [ "${option}" ]&&[ "${option}" != "Cancel" ]; then
|
||||
eval "$resultvar=\"${option/%\ */}\""
|
||||
fi
|
||||
break
|
||||
@ -306,7 +306,7 @@ if [ "${shortname}" == "core" ]; then
|
||||
echo -e "result: ${result}"
|
||||
echo -e "gameservername: ${gameservername}"
|
||||
fi
|
||||
elif [ -n "${userinput}" ]; then
|
||||
elif [ "${userinput}" ]; then
|
||||
fn_server_info
|
||||
if [ "${userinput}" == "${gameservername}" ]||[ "${userinput}" == "${gamename}" ]||[ "${userinput}" == "${shortname}" ]; then
|
||||
fn_install_file
|
||||
|
@ -160,7 +160,7 @@ fn_install_menu_bash() {
|
||||
done < "${options}"
|
||||
menu_options+=( "Cancel" )
|
||||
select option in "${menu_options[@]}"; do
|
||||
if [ -n "${option}" ]&&[ "${option}" != "Cancel" ]; then
|
||||
if [ "${option}" ]&&[ "${option}" != "Cancel" ]; then
|
||||
eval "$resultvar=\"${option/%\ */}\""
|
||||
fi
|
||||
break
|
||||
@ -306,7 +306,7 @@ if [ "${shortname}" == "core" ]; then
|
||||
echo -e "result: ${result}"
|
||||
echo -e "gameservername: ${gameservername}"
|
||||
fi
|
||||
elif [ -n "${userinput}" ]; then
|
||||
elif [ "${userinput}" ]; then
|
||||
fn_server_info
|
||||
if [ "${userinput}" == "${gameservername}" ]||[ "${userinput}" == "${gamename}" ]||[ "${userinput}" == "${shortname}" ]; then
|
||||
fn_install_file
|
||||
|
@ -160,7 +160,7 @@ fn_install_menu_bash() {
|
||||
done < "${options}"
|
||||
menu_options+=( "Cancel" )
|
||||
select option in "${menu_options[@]}"; do
|
||||
if [ -n "${option}" ]&&[ "${option}" != "Cancel" ]; then
|
||||
if [ "${option}" ]&&[ "${option}" != "Cancel" ]; then
|
||||
eval "$resultvar=\"${option/%\ */}\""
|
||||
fi
|
||||
break
|
||||
@ -306,7 +306,7 @@ if [ "${shortname}" == "core" ]; then
|
||||
echo -e "result: ${result}"
|
||||
echo -e "gameservername: ${gameservername}"
|
||||
fi
|
||||
elif [ -n "${userinput}" ]; then
|
||||
elif [ "${userinput}" ]; then
|
||||
fn_server_info
|
||||
if [ "${userinput}" == "${gameservername}" ]||[ "${userinput}" == "${gamename}" ]||[ "${userinput}" == "${shortname}" ]; then
|
||||
fn_install_file
|
||||
|
Loading…
Reference in New Issue
Block a user