fix(log): allow logs to correctly display primary command (#2958)

This commit is contained in:
Daniel Gibbs 2020-07-12 23:16:22 +01:00 committed by GitHub
parent a41f38801e
commit 8316d87853
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
56 changed files with 505 additions and 353 deletions

View File

@ -99,6 +99,7 @@ fn_alert_log
if [ "${postalert}" == "on" ]&&[ -n "${postalert}" ]; then
exitbypass=1
command_postdetails.sh
fn_commandname
elif [ "${postalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
fn_print_warn_nl "More Info not enabled"
fn_script_log_warn "More Info alerts not enabled"

View File

@ -20,5 +20,6 @@ if [ -f "${lockdir}/lastupdate.lock" ]&&[ "${status}" != "0" ]; then
fn_print_info "${selfname} has not been restarted since last update"
fn_script_log_info "${selfname} has not been restarted since last update"
command_restart.sh
fn_commandname
fi
fi

View File

@ -130,7 +130,7 @@ fn_check_steamcmd_clear(){
if [ "$(command -v steamcmd 2>/dev/null)" ]&&[ -d "${rootdir}/steamcmd" ]; then
rm -rf "${steamcmddir:?}"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_script_log_fatal "Removing ${rootdir}/steamcmd"
else
fn_script_log_pass "Removing ${rootdir}/steamcmd"

View File

@ -16,4 +16,5 @@ if [ -n "${modulesversion}" ]&&[ -n "${version}" ]&&[ "${version}" != "${modules
fn_sleep_time
fn_script_log_error "LinuxGSM Version mismatch: ${selfname}: ${version}: modules: ${modulesversion}"
command_update_linuxgsm.sh
fn_commandname
fi

View File

@ -5,9 +5,12 @@
# Website: https://linuxgsm.com
# Description: Creates a .tar.gz file in the backup directory.
commandname="BACKUP"
commandaction="Backing up"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="BACKUP"
commandaction="Backing up"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
check.sh
@ -61,22 +64,20 @@ fn_backup_init(){
# Check if server is started and whether to stop it.
fn_backup_stop_server(){
check_status.sh
# Server is stopped.
if [ "${status}" == "0" ]; then
serverstopped="no"
# Server is running and stoponbackup=off.
elif [ "${stoponbackup}" == "off" ]; then
serverstopped="no"
# Server is running but will not be stopped.
if [ "${stoponbackup}" == "off" ]; then
fn_print_warn_nl "${selfname} is currently running"
echo -e "* Although unlikely; creating a backup while ${selfname} is running might corrupt the backup."
fn_script_log_warn "${selfname} is currently running"
fn_script_log_warn "Although unlikely; creating a backup while ${selfname} is running might corrupt the backup"
# Server is running and will be stopped if stoponbackup=on or unset.
else
# If server is started
elif [ "${status}" != "0" ]; then
fn_stop_warning
serverstopped="yes"
startserver="1"
exitbypass=1
command_stop.sh
fn_commandname
fi
}
@ -140,7 +141,7 @@ fn_backup_compression(){
tar -czf "${backupdir}/${backupname}.tar.gz" -C "${rootdir}" --exclude "${excludedir}" --exclude "${lockdir}/backup.lock" ./.
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol
fn_script_log_fatal "Backup in progress: FAIL"
echo -e "${extractcmd}" | tee -a "${lgsmlog}"
@ -247,25 +248,26 @@ fn_backup_relpath() {
}
fn_stop_warning(){
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during backup"
fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during backup"
fn_print_warn "this game server will be stopped during backup"
fn_script_log_warn "this game server will be stopped during backup"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during backup: ${totalseconds}"
fn_print_warn "this game server will be stopped during backup: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during backup"
fn_print_warn_nl "this game server will be stopped during backup"
}
# Restart the server if it was stopped for the backup.
# Start the server if it was stopped for the backup.
fn_backup_start_server(){
if [ "${serverstopped}" == "yes" ]; then
if [ -n "${startserver}" ]; then
exitbypass=1
command_start.sh
fn_commandname
fi
}

View File

@ -4,9 +4,12 @@
# Website: https://linuxgsm.com
# Description: Gives access to the server tmux console.
commandname="CONSOLE"
commandaction="Access console"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="CONSOLE"
commandaction="Access console"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
check.sh
fn_print_header
@ -35,6 +38,7 @@ else
if fn_prompt_yn "Do you want to start the server?" Y; then
exitbypass=1
command_start.sh
fn_commandname
fi
fi

View File

@ -4,9 +4,12 @@
# Website: https://linuxgsm.com
# Description: Runs the server without tmux and directly from the terminal.
commandname="DEBUG"
commandaction="Debuging"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="DEBUG"
commandaction="Debuging"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
# Trap to remove lockfile on quit.
fn_lockfile_trap(){
@ -88,6 +91,7 @@ fn_print_info_nl "Stopping any running servers"
fn_script_log_info "Stopping any running servers"
exitbypass=1
command_stop.sh
fn_commandname
unset exitbypass
fn_print_dots "Starting debug"
fn_script_log_info "Starting debug"

View File

@ -5,9 +5,12 @@
# Website: https://linuxgsm.com
# Description: Displays server information.
commandname="DETAILS"
commandaction="Viewing details"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="DETAILS"
commandaction="Viewing details"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
# Run checks and gathers details to display.
check.sh

View File

@ -4,9 +4,12 @@
# Website: https://linuxgsm.com
# Description: Deletes the contents of the functions dir.
commandname="DEV-CLEAR-MODULES"
commandaction="Clearing modules"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="DEV-CLEAR-MODULES"
commandaction="Clearing modules"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
echo -e "================================="
echo -e "Clear Functions"

View File

@ -4,9 +4,12 @@
# Website: https://linuxgsm.com
# Description: Dev only: Enables debugging log to be saved to dev-debug.log.
commandname="DEV-DEBUG"
commandaction="Developer debug"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="DEV-DEBUG"
commandaction="Developer debug"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
if [ -f "${rootdir}/.dev-debug" ]; then
rm "${rootdir:?}/.dev-debug"

View File

@ -4,9 +4,12 @@
# Website: https://linuxgsm.com
# Description: Detects dependencies the server binary requires.
commandname="DEV-DETECT-DEPS"
commandaction="Developer detect deps"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="DEV-DETECT-DEPS"
commandaction="Developer detect deps"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
echo -e "================================="
echo -e "Dependencies Checker"

View File

@ -5,9 +5,12 @@
# Description: Automatically detects the version of GLIBC that is required.
# Can check a file or directory recursively.
commandname="DEV-DETECT-GLIBC"
commandaction="Developer detect glibc"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="DEV-DETECT-GLIBC"
commandaction="Developer detect glibc"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
echo -e "================================="
echo -e "glibc Requirements Checker"

View File

@ -5,9 +5,12 @@
# Description: Automatically detects required deps using ldd.
# Can check a file or directory recursively.
commandname="DEV-DETECT-LDD"
commandaction="Developer detect ldd"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="DEV-DETECT-LDD"
commandaction="Developer detect ldd"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
echo -e "================================="
echo -e "Shared Object dependencies Checker"

View File

@ -4,9 +4,12 @@
# Website: https://linuxgsm.com
# Description: Raw gamedig output of the server.
commandname="DEV-QUERY-RAW"
commandaction="Developer query raw"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="DEV-QUERY-RAW"
commandaction="Developer query raw"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
check.sh
info_config.sh

View File

@ -4,9 +4,12 @@
# Website: https://linuxgsm.com
# Description: Shows ways to donate.
commandname="DONATE"
commandaction="Donate"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="DONATE"
commandaction="Donate"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
fn_print_ascii_logo
echo -e "${lightyellow}Support LinuxGSM${default}"

View File

@ -5,9 +5,12 @@
# Website: https://linuxgsm.com
# Description: Creates a FastDL directory.
commandname="FASTDL"
commandaction="Fastdl"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="FASTDL"
commandaction="Fastdl"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
check.sh
@ -69,7 +72,7 @@ fn_clear_old_fastdl(){
echo -en "clearing existing FastDL directory ${fastdldir}..."
rm -fR "${fastdldir:?}"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Clearing existing FastDL directory ${fastdldir}"
core_exit.sh
@ -86,7 +89,7 @@ fn_fastdl_dirs(){
echo -en "creating web directory ${webdir}..."
mkdir -p "${webdir}"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Creating web directory ${webdir}"
core_exit.sh
@ -99,7 +102,7 @@ fn_fastdl_dirs(){
echo -en "creating fastdl directory ${fastdldir}..."
mkdir -p "${fastdldir}"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Creating fastdl directory ${fastdldir}"
core_exit.sh
@ -245,7 +248,7 @@ fn_fastdl_gmod(){
echo -e "copying ${allowed_extention} : ${fileswc}..."
cp --parents "${fastdlfile}" "${fastdldir}"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Copying ${fastdlfile} > ${fastdldir}"
core_exit.sh
@ -262,7 +265,7 @@ fn_fastdl_gmod(){
echo -en "updating addons file structure..."
cp -Rf "${fastdldir}"/addons/*/* "${fastdldir}"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Updating addons file structure"
core_exit.sh
@ -275,7 +278,7 @@ fn_fastdl_gmod(){
fn_sleep_time
rm -fR "${fastdldir:?}/addons"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Clearing addons dir from fastdl dir"
core_exit.sh
@ -290,7 +293,7 @@ fn_fastdl_gmod(){
fn_sleep_time
cp -Rf "${fastdldir}/lua/"* "${fastdldir}"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Correcting DarkRP files"
core_exit.sh
@ -342,7 +345,7 @@ fn_fastdl_source(){
fi
cp "${fastdlfile}" "${fastdldir}/${copytodir}"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Copying ${fastdlfile} > ${fastdldir}/${copytodir}"
core_exit.sh
@ -378,7 +381,7 @@ fn_fastdl_gmod_dl_enforcer(){
echo -en "removing existing download enforcer: ${luafastdlfile}..."
rm -f "${luafastdlfullpath:?}"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Removing existing download enforcer ${luafastdlfullpath}"
core_exit.sh
@ -396,7 +399,7 @@ fn_fastdl_gmod_dl_enforcer(){
echo -e "resource.AddFile( \"${line}\" )" >> "${luafastdlfullpath}"
done < <(find "${fastdldir:?}" \( -type f ! -name "*.bz2" \) -printf '%P\n')
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Creating new download enforcer ${luafastdlfullpath}"
core_exit.sh
@ -413,7 +416,7 @@ fn_fastdl_bzip2(){
echo -en "\r\033[Kcompressing ${filetocompress}..."
bzip2 -f "${filetocompress}"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Compressing ${filetocompress}"
core_exit.sh

View File

@ -5,9 +5,12 @@
# Website: https://linuxgsm.com
# Description: Overall function for the installer.
commandname="INSTALL"
commandaction="Installing"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="INSTALL"
commandaction="Installing"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
check.sh
if [ "$(whoami)" = "root" ]; then
@ -42,6 +45,7 @@ else
install_ts3db.sh
elif [ "${shortname}" == "mta" ]; then
command_install_resources_mta.sh
fn_commandname
fi
fix.sh

View File

@ -4,9 +4,12 @@
# Website: https://linuxgsm.com
# Description: Installs the default resources for Multi Theft Auto.
commandname="DEFAULT-RESOURCES"
commandaction="Default Resources"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="DEFAULT-RESOURCES"
commandaction="Default Resources"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
fn_install_resources(){
echo -e ""

View File

@ -5,9 +5,12 @@
# Website: https://linuxgsm.com
# Description: List and installs available mods along with mods_list.sh and mods_core.sh.
commandname="MODS-INSTALL"
commandaction="Installing mods"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="MODS-INSTALL"
commandaction="Installing mods"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
check.sh
mods_core.sh

View File

@ -5,9 +5,12 @@
# Website: https://linuxgsm.com
# Description: Uninstall mods along with mods_list.sh and mods_core.sh.
commandname="MODS-REMOVE"
commandaction="Removing mods"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="MODS-REMOVE"
commandaction="Removing mods"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
check.sh
mods_core.sh
@ -70,7 +73,7 @@ while [ "${modfileline}" -le "${modsfilelistsize}" ]; do
if [ -f "${modinstalldir}/${currentfileremove}" ]||[ -d "${modinstalldir}/${currentfileremove}" ]; then
rm -rf "${modinstalldir:?}/${currentfileremove:?}"
((exitcode=$?))
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_script_log_fatal "Removing ${modinstalldir}/${currentfileremove}"
break
else
@ -81,7 +84,7 @@ while [ "${modfileline}" -le "${modsfilelistsize}" ]; do
echo -e "removing ${modprettyname} ${modfileline} / ${modsfilelistsize} : ${currentfileremove}..."
((modfileline++))
done
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
core_exit.sh
else
@ -92,7 +95,7 @@ echo -en "removing ${modcommand}-files.txt..."
fn_sleep_time
rm -rf "${modsdir:?}/${modcommand}-files.txt"
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_script_log_fatal "Removing ${modsdir}/${modcommand}-files.txt"
fn_print_fail_eol_nl
core_exit.sh
@ -107,7 +110,7 @@ fn_sleep_time
sed -i "/^${modcommand}$/d" "${modsinstalledlistfullpath}"
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_script_log_fatal "Removing ${modcommand} from ${modsinstalledlist}"
fn_print_fail_eol_nl
core_exit.sh
@ -123,6 +126,7 @@ if [ "${engine}" == "unity3d" ]&&[[ "${modprettyname}" == *"Oxide"* ]]; then
fn_script_log "Validating to restore original ${gamename} files replaced by Oxide"
exitbypass="1"
command_validate.sh
fn_commandname
unset exitbypass
fi
echo -e "${modprettyname} removed"

View File

@ -5,9 +5,12 @@
# Website: https://linuxgsm.com
# Description: Updates installed mods along with mods_list.sh and mods_core.sh.
commandname="MODS-UPDATE"
commandaction="Updating mods"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="MODS-UPDATE"
commandaction="Updating mods"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
check.sh
mods_core.sh

View File

@ -6,9 +6,12 @@
# Description: Monitors server by checking for running processes
# then passes to gamedig and gsquery.
commandname="MONITOR"
commandaction="Monitoring"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="MONITOR"
commandaction="Monitoring"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
fn_monitor_check_lockfile(){
# Monitor does not run it lockfile is not found.
@ -170,6 +173,7 @@ for queryattempt in {1..5}; do
alert="restartquery"
alert.sh
command_restart.sh
fn_commandname
core_exit.sh
fi
elif [ "${querymethod}" == "gamedig" ]; then

View File

@ -5,9 +5,12 @@
# Website: https://linuxgsm.com
# Description: Strips sensitive information out of Details output
commandname="POST-DETAILS"
commandaction="Posting details"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="POST-DETAILS"
commandaction="Posting details"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
# Set posttarget to the appropriately-defined post destination.

View File

@ -4,13 +4,16 @@
# Website: https://linuxgsm.com
# Description: Restarts the server.
commandname="MODS-INSTALL"
commandaction="Restarting"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="MODS-INSTALL"
commandaction="Restarting"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
info_config.sh
exitbypass=1
command_stop.sh
command_start.sh
fn_commandname
core_exit.sh

View File

@ -5,9 +5,12 @@
# Website: https://linuxgsm.com
# Description: Starts the server.
commandname="START"
commandaction="Starting"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="START"
commandaction="Starting"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
fn_start_teamspeak3(){
if [ ! -f "${servercfgfullpath}" ]; then
@ -188,8 +191,7 @@ if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateon
exitbypass=1
unset updateonstart
command_update.sh
commandname="START"
commandaction="Starting"
fn_commandname
fi
fn_print_dots "${servername}"

View File

@ -5,9 +5,12 @@
# Website: https://linuxgsm.com
# Description: Stops the server.
commandname="STOP"
commandaction="Stopping"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="STOP"
commandaction="Stopping"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
# Attempts graceful shutdown by sending 'CTRL+c'.
fn_stop_graceful_ctrlc(){

View File

@ -4,9 +4,12 @@
# Website: https://linuxgsm.com
# Description: Sends a test alert.
commandname="TEST-ALERT"
commandaction="Sending Alert"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="TEST-ALERT"
commandaction="Sending Alert"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
fn_print_dots "${servername}"
check.sh

View File

@ -5,9 +5,12 @@
# Website: https://linuxgsm.com
# Description: Changes TS3 serveradmin password.
commandname="CHANGE-PASSWORD"
commandaction="Changing password"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="CHANGE-PASSWORD"
commandaction="Changing password"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
fn_serveradmin_password_prompt(){
fn_print_header
@ -28,6 +31,7 @@ fn_serveradmin_password_set(){
ts3serverpass="1"
exitbypass="1"
command_start.sh
fn_commandname
fn_print_ok_nl "New password applied"
fn_script_log_pass "New ServerAdmin password applied"
}
@ -39,13 +43,16 @@ if [ "${status}" != "0" ]; then
# Stop any running server.
exitbypass="1"
command_stop.sh
fn_commandname
fn_serveradmin_password_set
parms="serveradmin_password=\"${newpassword}\" inifile=\"${servercfgfullpath}\" > /dev/null 2>&1"
ts3serverpass="0"
command_restart.sh
fn_commandname
else
fn_serveradmin_password_set
command_stop.sh
fn_commandname
fi
core_exit.sh

View File

@ -4,9 +4,12 @@
# Website: https://linuxgsm.com
# Description: Handles updating of servers.
commandname="UPDATE"
commandaction="Updating"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="UPDATE"
commandaction="Updating"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
fn_print_dots ""
check.sh

View File

@ -4,9 +4,12 @@
# Website: https://linuxgsm.com
# Description: Deletes the functions dir to allow re-downloading of functions from GitHub.
commandname="UPDATE-LGSM"
commandaction="Updating LinuxGSM"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="UPDATE-LGSM"
commandaction="Updating LinuxGSM"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
check.sh

View File

@ -4,23 +4,26 @@
# Website: https://linuxgsm.com
# Description: Runs a server validation.
commandname="VALIDATE"
commandaction="Validating"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="VALIDATE"
commandaction="Validating"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
fn_validate(){
fn_script_log_warn "Validating server: SteamCMD: Validate might overwrite some customised files"
fn_script_log_warn "SteamCMD: Validate might overwrite some customised files"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "Validating server: SteamCMD: Validate might overwrite some customised files: ${totalseconds}"
fn_print_warn "SteamCMD: Validate might overwrite some customised files: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "Validating server: SteamCMD: Validate might overwrite some customised files"
fn_print_start_nl "Validating server: SteamCMD"
fn_print_warn_nl "SteamCMD: Validate might overwrite some customised files"
fn_print_start_nl "SteamCMD"
fn_script_log_info "Validating server: SteamCMD"
if [ -d "${steamcmddir}" ]; then
cd "${steamcmddir}" || exit
@ -40,8 +43,7 @@ fn_validate(){
${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" +app_update "${appid}" validate +quit | tee -a "${lgsmlog}"
fi
elif [ "${shortname}" == "ac" ]; then
${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" validate +quit
local exitcode=$?
${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" validate +quit | tee -a "${lgsmlog}"
# All other servers.
elif [ -n "${branch}" ]; then
${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}"
@ -50,42 +52,43 @@ fn_validate(){
fi
exitcode=$?
fn_print_dots "Validating server: SteamCMD"
fn_print_dots "SteamCMD"
if [ "${exitcode}" != "0" ]; then
fn_print_fail_nl "Validating server: SteamCMD"
fn_print_fail_nl "SteamCMD"
fn_script_log_fatal "Validating server: SteamCMD: FAIL"
else
fn_print_ok_nl "Validating server: SteamCMD"
fn_print_ok_nl "SteamCMD"
fn_script_log_pass "Validating server: SteamCMD: OK"
fi
core_exit.sh
}
fn_stop_warning(){
fn_print_warn "Validating server: SteamCMD: ${selfname} will be stopped during validation"
fn_script_log_warn "Validating server: SteamCMD: ${selfname} will be stopped during validation"
fn_print_warn "this game server will be stopped during validate"
fn_script_log_warn "this game server will be stopped during validate"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "Validating server: SteamCMD: ${selfname} will be stopped during validation: ${totalseconds}"
fn_print_warn "this game server will be stopped during validate: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "Validating server: SteamCMD: ${selfname} will be stopped during validation"
fn_print_warn_nl "this game server will be stopped during validate"
}
fn_print_dots "Validating server"
fn_print_dots "Validating server: SteamCMD"
fn_print_dots "SteamCMD"
check.sh
if [ "${status}" != "0" ]; then
fn_stop_warning
exitbypass=1
command_stop.sh
fn_commandname
fn_validate
exitbypass=1
command_start.sh
fn_commandname
else
fn_validate
fi

View File

@ -5,34 +5,17 @@
# Website: https://linuxgsm.com
# Description: Wipes server data, useful after updates for some games like Rust
commandname="WIPE"
commandaction="Wiping"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
check.sh
fn_print_header
fn_script_log "Entering ${gamename} ${commandaction}"
# Process to server wipe.
fn_wipe_server_process(){
check_status.sh
if [ "${status}" != "0" ]; then
exitbypass=1
command_stop.sh
fn_wipe_server_remove_files
exitbypass=1
command_start.sh
else
fn_wipe_server_remove_files
fi
echo -e "server data wiped"
fn_script_log "server data wiped."
fn_commandname(){
commandname="WIPE"
commandaction="Wiping"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
# Provides an exit code upon error.
fn_wipe_exit_code(){
((exitcode=$?))
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_script_log_fatal "${currentaction}"
core_exit.sh
else
@ -41,166 +24,190 @@ fn_wipe_exit_code(){
}
# Removes files to wipe server.
fn_wipe_server_remove_files(){
# Rust Wipe.
if [ "${shortname}" == "rust" ]; then
# Wipe pocedural map.
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
fn_script_log "${currentaction}"
find "${serveridentitydir:?}" -type f -name "proceduralmap.*.map" -delete
fn_wipe_exit_code
fn_sleep_time
else
fn_print_information_nl "No procedural map file to remove"
fn_script_log_info "No procedural map file to remove."
fi
# Wipe procedural map save.
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
fn_script_log "${currentaction}"
find "${serveridentitydir:?}" -type f -name "proceduralmap.*.sav" -delete
fn_wipe_exit_code
fn_sleep_time
else
fn_print_information_nl "No procedural map save to remove"
fn_script_log_info "No procedural map save to remove."
fi
# Wipe Barren map.
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
fn_script_log "${currentaction}"
find "${serveridentitydir:?}" -type f -name "barren*.map" -delete
fn_wipe_exit_code
fn_sleep_time
else
fn_print_information_nl "No barren map file to remove"
fn_script_log_info "No barren map file to remove."
fi
# Wipe barren map save.
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
fn_script_log "${currentaction}"
find "${serveridentitydir:?}" -type f -name "barren*.sav" -delete
fn_wipe_exit_code
fn_sleep_time
else
fn_print_information_nl "No barren map save to remove"
fn_script_log_info "No barren map save to remove."
fi
# Wipe user dir, might be a legacy thing, maybe to be removed.
if [ -d "${serveridentitydir}/user" ]; then
currentaction="Removing user directory: ${serveridentitydir}/user"
echo -en "Removing user directory..."
fn_sleep_time
fn_script_log "${currentaction}"
rm -rf "${serveridentitydir:?}/user"
fn_wipe_exit_code
fn_sleep_time
fn_wipe_server_files(){
fn_print_start_nl "Wiping server"
fn_script_log_info "Wiping server"
# Wipe procedural map.
if [ "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.map")" ]; then
echo -en "removing procedural map proceduralmap.*.map file(s)..."
fn_sleep_time
fn_script_log_info "Removing procedural map file(s): ${serveridentitydir}/proceduralmap.*.map"
find "${serveridentitydir:?}" -type f -name "proceduralmap.*.map" -delete | tee -a "${lgsmlog}"
fn_wipe_exit_code
fn_sleep_time
else
echo -e "no procedural map file to remove"
fn_sleep_time
fn_script_log_pass "No procedural map file to remove"
fi
# Wipe procedural map save.
if [ "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.sav")" ]; then
echo -en "removing map saves proceduralmap.*.sav file(s)..."
fn_sleep_time
fn_script_log_info "Removing procedural map save(s): ${serveridentitydir}/proceduralmap.*.sav"
find "${serveridentitydir:?}" -type f -name "proceduralmap.*.sav" -delete | tee -a "${lgsmlog}"
fn_wipe_exit_code
fn_sleep_time
else
echo -e "no procedural map save to remove"
fn_sleep_time
fn_script_log_pass "No procedural map save to remove"
fi
# Wipe Barren map.
if [ "$(find "${serveridentitydir}" -type f -name "barren*.map")" ]; then
echo -en "removing barren map barren*.map file(s)..."
fn_sleep_time
fn_script_log_info "Removing map file(s): ${serveridentitydir}/barren*.map"
find "${serveridentitydir:?}" -type f -name "barren*.map" -delete | tee -a "${lgsmlog}"
fn_wipe_exit_code
fn_sleep_time
else
echo -e "no barren map file to remove"
fn_sleep_time
fn_script_log_pass "No barren map file to remove"
fi
# Wipe barren map save.
if [ "$(find "${serveridentitydir}" -type f -name "barren*.sav")" ]; then
echo -en "removing barren map saves barren*.sav file(s)..."
fn_sleep_time
fn_script_log_info "Removing barren map save(s): ${serveridentitydir}/barren*.sav"
find "${serveridentitydir:?}" -type f -name "barren*.sav" -delete | tee -a "${lgsmlog}"
fn_wipe_exit_code
fn_sleep_time
else
echo -e "no barren map save to remove"
fn_sleep_time
fn_script_log_pass "No barren map save to remove."
fi
# Wipe user dir, might be a legacy thing, maybe to be removed.
if [ -d "${serveridentitydir}/user" ]; then
echo -en "removing user directory..."
fn_sleep_time
fn_script_log_info "removing user directory: ${serveridentitydir}/user"
rm -rf "${serveridentitydir:?}/user"
fn_wipe_exit_code
fn_sleep_time
# We do not print additional information if there is nothing to remove since this might be obsolete.
fi
# Wipe storage dir, might be a legacy thing, maybe to be removed.
if [ -d "${serveridentitydir}/storage" ]; then
currentaction="Removing storage directory: ${serveridentitydir}/storage"
echo -en "Removing storage directory..."
fn_sleep_time
fn_script_log "${currentaction}"
rm -rf "${serveridentitydir:?}/storage"
fn_wipe_exit_code
fn_sleep_time
fi
# Wipe storage dir, might be a legacy thing, maybe to be removed.
if [ -d "${serveridentitydir}/storage" ]; then
echo -en "removing storage directory..."
fn_sleep_time
fn_script_log_info "removing storage directory: ${serveridentitydir}/storage"
rm -rf "${serveridentitydir:?}/storage"
fn_wipe_exit_code
fn_sleep_time
# We do not print additional information if there is nothing to remove since this might be obsolete.
fi
# Wipe sv.files.
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
fn_script_log "${currentaction}"
find "${serveridentitydir:?}" -type f -name "sv.files.*.db" -delete
fn_wipe_exit_code
fn_sleep_time
fi
# Wipe sv.files.
if [ "$(find "${serveridentitydir}" -type f -name "sv.files.*.db")" ]; then
echo -en "removing server misc srv.files*.db file(s)..."
fn_sleep_time
fn_script_log_info "Removing server misc files: ${serveridentitydir}/sv.files.*.db"
find "${serveridentitydir:?}" -type f -name "sv.files.*.db" -delete | tee -a "${lgsmlog}"
fn_wipe_exit_code
fn_sleep_time
# No further information if not found because it should I could not get this file showing up.
fi
# Wipe player death files.
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)..."
fi
# Wipe player death files.
if [ "$(find "${serveridentitydir}" -type f -name "player.deaths.*.db")" ]; then
echo -en "removing player deaths player.deaths.*.db file(s)..."
fn_sleep_time
fn_script_log_info "Removing player death files: ${serveridentitydir}/player.deaths.*.db"
find "${serveridentitydir:?}" -type f -name "player.deaths.*.db" -delete | tee -a "${lgsmlog}"
fn_wipe_exit_code
fn_sleep_time
else
echo -e "no player death to remove"
fn_sleep_time
fn_script_log_pass "No player death to remove"
fi
# Wipe blueprints only if full-wipe command was used.
if [ "${fullwipe}" == "1" ]; then
if [ "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]; then
echo -en "removing blueprints player.blueprints.*.db file(s)..."
fn_sleep_time
fn_script_log "${currentaction}"
find "${serveridentitydir:?}" -type f -name "player.deaths.*.db" -delete
fn_script_log_info "Removing blueprint file(s): ${serveridentitydir}/player.blueprints.*.db"
find "${serveridentitydir:?}" -type f -name "player.blueprints.*.db" -delete | tee -a "${lgsmlog}"
fn_wipe_exit_code
fn_sleep_time
else
fn_print_information_nl "No player death to remove"
fn_script_log_info "No player death to remove."
fi
# Wipe blueprints only if wipeall command was used.
if [ "${wipeall}" == "1" ]; 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
fn_script_log "${currentaction}"
find "${serveridentitydir:?}" -type f -name "player.blueprints.*.db" -delete
fn_wipe_exit_code
fn_sleep_time
else
fn_print_information_nl "No blueprint file to remove"
fn_script_log_info "No blueprint file to remove."
fi
elif [ "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]; then
fn_print_information_nl "Keeping blueprints"
fn_script_log_info "Keeping blueprints."
else
fn_print_information_nl "No blueprints found"
fn_script_log_info "No blueprints found."
fn_sleep_time
fi
# Wipe some logs that might be there.
if [ "$(find "${serveridentitydir}" -type f -name "Log.*.txt")" ]; then
currentaction="Removing log files: ${serveridentitydir}/Log.*.txt"
echo -en "Removing Log files..."
echo -e "no blueprint file to remove"
fn_sleep_time
fn_script_log "${currentaction}"
find "${serveridentitydir:?}" -type f -name "Log.*.txt" -delete
fn_wipe_exit_code
fn_script_log_pass "No blueprint file to remove"
fi
elif [ "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]; then
echo -e "keeping blueprints"
fn_sleep_time
fn_script_log_info "Keeping blueprints"
else
echo -e "no blueprints found"
fn_sleep_time
fn_script_log_pass "No blueprints found"
fi
# Wipe some logs that might be there.
if [ "$(find "${serveridentitydir}" -type f -name "Log.*.txt")" ]; then
echo -en "removing Log files..."
fn_sleep_time
fn_script_log_info "Removing log files: ${serveridentitydir}/Log.*.txt"
find "${serveridentitydir:?}" -type f -name "Log.*.txt" -delete
fn_wipe_exit_code
fn_sleep_time
# We do not print additional information if there are no logs to remove.
fi
# You can add an "elif" here to add another game or engine.
fi
}
# Check if there is something to wipe, prompt the user, and call appropriate functions.
# Rust Wipe.
if [ "${shortname}" == "rust" ]; then
if [ -d "${serveridentitydir}/storage" ]||[ -d "${serveridentitydir}/user" ]||[ -n "$(find "${serveridentitydir}" -type f -name "proceduralmap*.sav")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "barren*.sav")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "Log.*.txt")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "player.deaths.*.db")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "sv.files.*.db")" ]; then
fn_print_warning_nl "Any user, storage, log and map data from ${serveridentitydir} will be erased."
if ! fn_prompt_yn "Continue?" Y; then
core_exit.sh
fn_stop_warning(){
fn_print_warn "this game server will be stopped during wipe"
fn_script_log_warn "this game server will be stopped during wipe"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "this game server will be stopped during wipe: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
fn_script_log_info "User selects to erase any user, storage, log and map data from ${serveridentitydir}"
fn_sleep_time
fn_wipe_server_process
done
fn_print_warn_nl "this game server will be stopped during wipe"
}
fn_wipe_warning(){
fn_print_warn "wipe is about to start"
fn_script_log_warn "wipe is about to start"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "wipe is about to start: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn "wipe is about to start"
}
fn_print_dots ""
check.sh
# Check if there is something to wipe.
if [ -d "${serveridentitydir}/storage" ]||[ -d "${serveridentitydir}/user" ]||[ -n "$(find "${serveridentitydir}" -type f -name "proceduralmap*.sav")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "barren*.sav")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "Log.*.txt")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "player.deaths.*.db")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "sv.files.*.db")" ]; then
fn_wipe_warning
check_status.sh
if [ "${status}" != "0" ]; then
fn_stop_warning
exitbypass=1
command_stop.sh
fn_commandname
fn_wipe_server_files
exitbypass=1
command_start.sh
fn_commandname
else
fn_print_information_nl "No data to wipe was found"
fn_script_log_info "No data to wipe was found."
core_exit.sh
fn_wipe_server_files
fi
# You can add an "elif" here to add another game or engine.
else
# Game not listed.
fn_print_information_nl "Wipe is not available for this game"
fn_script_log_info "Wipe is not available for this game."
core_exit.sh
fn_print_ok_nl ""
fn_script_log_pass "Wiping server"
fi
core_exit.sh

View File

@ -4,9 +4,12 @@
# Website: https://linuxgsm.com
# Description: Compresses unreal maps.
commandname="MAP-COMPRESSOR"
commandaction="Compressing maps"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="MAP-COMPRESSOR"
commandaction="Compressing maps"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
check.sh
fn_print_header

View File

@ -4,9 +4,12 @@
# Website: https://linuxgsm.com
# Description: Compresses unreal maps.
commandname="MAP-COMPRESSOR"
commandaction="Compressing maps"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_commandname(){
commandname="MAP-COMPRESSOR"
commandaction="Compressing maps"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
}
fn_commandname
check.sh
fn_print_header

View File

@ -25,7 +25,7 @@ fn_clear_tmp(){
if [ -d "${tmpdir}" ]; then
rm -rf "${tmpdir:?}/"*
local exitcode=$?
if [ ${exitcode} -eq 0 ]; then
if [ "${exitcode}" == 0 ]; then
fn_print_ok_eol_nl
fn_script_log_pass "clearing LinuxGSM tmp directory"
else
@ -82,7 +82,7 @@ fn_dl_extract(){
extractcmd=$(unzip -qo -d "${extractdir}" "${local_filedir}/${local_filename}")
fi
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Extracting download"
if [ -f "${lgsmlog}" ]; then
@ -171,7 +171,7 @@ fn_fetch_file(){
fi
# On first try will error. On second try will fail.
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
if [ ${counter} -ge 2 ]; then
fn_print_fail_eol_nl
if [ -f "${lgsmlog}" ]; then

View File

@ -21,11 +21,15 @@ echo -e "forcing server restart..."
fn_sleep_time
exitbypass=1
command_start.sh
fn_commandname
sleep 5
exitbypass=1
command_stop.sh
fn_commandname
exitbypass=1
command_start.sh
fn_commandname
sleep 5
exitbypass=1
command_stop.sh
fn_commandname

View File

@ -14,6 +14,8 @@ fn_print_information "starting ${gamename} server to generate configs."
fn_sleep_time
exitbypass=1
command_start.sh
fn_commandname
sleep 10
exitbypass=1
command_stop.sh
fn_commandname

View File

@ -24,11 +24,15 @@ echo -e "forcing server restart..."
fn_sleep_time
exitbypass=1
command_start.sh
fn_commandname
sleep 5
exitbypass=1
command_stop.sh
fn_commandname
exitbypass=1
command_start.sh
fn_commandname
sleep 5
exitbypass=1
command_stop.sh
fn_commandname

View File

@ -21,11 +21,15 @@ echo -e "forcing server restart."
fn_sleep_time
exitbypass=1
command_start.sh
fn_commandname
sleep 5
exitbypass=1
command_stop.sh
fn_commandname
exitbypass=1
command_start.sh
fn_commandname
sleep 5
exitbypass=1
command_stop.sh
fn_commandname

View File

@ -14,6 +14,8 @@ fn_print_information "starting ${gamename} server to generate configs."
fn_sleep_time
exitbypass=1
command_start.sh
fn_commandname
sleep 10
exitbypass=1
command_stop.sh
fn_commandname

View File

@ -18,8 +18,10 @@ if [ ! -d "${serverfiles}/Creative" ]; then
fixbypass=1
exitbypass=1
command_start.sh
fn_commandname
sleep 10
exitbypass=1
command_stop.sh
fn_commandname
unset parmsbypass
fi

View File

@ -135,7 +135,7 @@ fn_info_message_gameserver_resource(){
echo -e "${lightyellow}Game Server Resource Usage${default}"
fn_messages_separator
{
if [ "${status}" == "1" ]; then
if [ "${status}" != "0" ]; then
echo -e "${lightblue}CPU Used:\t${default}${cpuused}%${default}"
echo -e "${lightblue}Mem Used:\t${default}${pmemused}%\t${memused}MB${default}"
else
@ -1515,7 +1515,7 @@ fn_info_message_select_engine(){
elif [ "${shortname}" == "bf1942" ]; then
fn_info_message_bf1942
elif [ "${shortname}" == "bfv" ]; then
fn_info_message_bfv
fn_info_message_bfv
elif [ "${shortname}" == "rtcw" ]; then
fn_info_message_rtcw
elif [ "${shortname}" == "rust" ]; then

View File

@ -14,3 +14,4 @@ cp "${tmpdir}/LinuxGSM-master/lgsm/functions"/*.sh "${functionsdir}"
cp "${tmpdir}/LinuxGSM-master/lgsm/functions"/*.py "${functionsdir}"
chmod +x "${functionsdir}"/*
command_update_linuxgsm.sh
fn_commandname

View File

@ -53,7 +53,7 @@ fn_mod_lowercase(){
done < <(find "${extractdir}" -depth)
echo -en "${renamedwc} / ${totalfileswc} / ${fileswc} converting ${modprettyname} files to lowercase..."
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
core_exit.sh
else
@ -69,7 +69,7 @@ fn_mod_create_filelist(){
# ${modsdir}/${modcommand}-files.txt.
find "${extractdir}" -mindepth 1 -printf '%P\n' > "${modsdir}/${modcommand}-files.txt"
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Building ${modsdir}/${modcommand}-files.txt"
core_exit.sh
@ -89,7 +89,7 @@ fn_mod_copy_destination(){
fn_sleep_time
cp -Rf "${extractdir}/." "${modinstalldir}/"
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Copying ${modprettyname} to ${modinstalldir}"
else
@ -127,7 +127,7 @@ fn_mod_tidy_files_list(){
sed -i "/^${removefilevar}$/d" "${modsdir}/${modcommand}-files.txt"
# Exit on error.
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Error while tidying line: ${removefilevar} from: ${modsdir}/${modcommand}-files.txt"
core_exit.sh
@ -382,7 +382,7 @@ fn_create_mods_dir(){
echo -en "creating LinuxGSM mods data directory ${modsdir}..."
mkdir -p "${modsdir}"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Creating mod download dir ${modsdir}"
core_exit.sh
@ -396,7 +396,7 @@ fn_create_mods_dir(){
echo -en "creating mods install directory ${modinstalldir}..."
mkdir -p "${modinstalldir}"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Creating mod install directory ${modinstalldir}"
core_exit.sh
@ -419,7 +419,7 @@ fn_mods_create_tmp_dir(){
mkdir -p "${modstmpdir}"
exitcode=$?
echo -en "creating mod download directory ${modstmpdir}..."
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Creating mod download directory ${modstmpdir}"
core_exit.sh
@ -436,7 +436,7 @@ fn_mods_clear_tmp_dir(){
echo -en "clearing mod download directory ${modstmpdir}..."
rm -fr "${modstmpdir:?}"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
fn_print_fail_eol_nl
fn_script_log_fatal "Clearing mod download directory ${modstmpdir}"
core_exit.sh

View File

@ -96,17 +96,21 @@ fn_update_factorio_compare(){
fn_update_factorio_dl
exitbypass=1
command_start.sh
fn_commandname
exitbypass=1
command_stop.sh
fn_commandname
# If server started.
else
fn_stop_warning
exitbypass=1
command_stop.sh
fn_commandname
exitbypass=1
fn_update_factorio_dl
exitbypass=1
command_start.sh
fn_commandname
fi
date +%s > "${lockdir}/lastupdate.lock"
alert="update"
@ -131,18 +135,18 @@ fn_update_factorio_compare(){
}
fn_stop_warning(){
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_print_warn "this game server will be stopped during update"
fn_script_log_warn "this game server will be stopped during update"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}"
fn_print_warn "this game server will be stopped during update: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_print_warn_nl "this game server will be stopped during update"
}
# The location where the builds are checked and downloaded.

View File

@ -44,8 +44,10 @@ fn_update_minecraft_localbuild(){
fn_script_log_info "Forcing server restart"
exitbypass=1
command_stop.sh
fn_commandname
exitbypass=1
command_start.sh
fn_commandname
totalseconds=0
# Check again, allow time to generate logs.
while [ ! -f "${serverfiles}/logs/latest.log" ]; do
@ -157,15 +159,18 @@ fn_update_minecraft_compare(){
command_start.sh
exitbypass=1
command_stop.sh
fn_commandname
# If server started.
else
fn_stop_warning
exitbypass=1
command_stop.sh
fn_commandname
exitbypass=1
fn_update_minecraft_dl
exitbypass=1
command_start.sh
fn_commandname
fi
date +%s > "${lockdir}/lastupdate.lock"
alert="update"
@ -190,18 +195,18 @@ fn_update_minecraft_compare(){
}
fn_stop_warning(){
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_print_warn "this game server will be stopped during update"
fn_script_log_warn "this game server will be stopped during update"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}"
fn_print_warn "this game server will be stopped during update: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_print_warn_nl "this game server will be stopped during update"
}
# The location where the builds are checked and downloaded.

View File

@ -47,13 +47,16 @@ fn_update_minecraft_localbuild(){
if [ "${status}" == "0" ]; then
exitbypass=1
command_start.sh
fn_commandname
sleep 3
exitbypass=1
command_stop.sh
fn_commandname
# If server started.
else
exitbypass=1
command_stop.sh
fn_commandname
fi
fi
@ -123,15 +126,18 @@ fn_update_minecraft_compare(){
command_start.sh
exitbypass=1
command_stop.sh
fn_commandname
# If server started.
else
fn_stop_warning
exitbypass=1
command_stop.sh
fn_commandname
exitbypass=1
fn_update_minecraft_dl
exitbypass=1
command_start.sh
fn_commandname
fi
date +%s > "${lockdir}/lastupdate.lock"
alert="update"
@ -150,18 +156,18 @@ fn_update_minecraft_compare(){
}
fn_stop_warning(){
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_print_warn "this game server will be stopped during update"
fn_script_log_warn "this game server will be stopped during update"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}"
fn_print_warn "this game server will be stopped during update: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_print_warn_nl "this game server will be stopped during update"
}
# The location where the builds are checked and downloaded.

View File

@ -40,6 +40,7 @@ fn_update_mta_localbuild(){
command_stop.sh
exitbypass=1
command_start.sh
fn_commandname
totalseconds=0
# Check again, allow time to generate logs.
while [ ! -f "${serverfiles}/mods/deathmatch/logs/server.log" ]; do
@ -154,15 +155,18 @@ fn_update_mta_compare(){
command_start.sh
exitbypass=1
command_stop.sh
fn_commandname
# If server started.
else
fn_stop_warning
exitbypass=1
command_stop.sh
fn_commandname
exitbypass=1
fn_update_mta_dl
exitbypass=1
command_start.sh
fn_commandname
fi
date +%s > "${lockdir}/lastupdate.lock"
alert="update"
@ -181,18 +185,18 @@ fn_update_mta_compare(){
}
fn_stop_warning(){
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_print_warn "this game server will be stopped during update"
fn_script_log_warn "this game server will be stopped during update"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}"
fn_print_warn "this game server will be stopped during update: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_print_warn_nl "this game server will be stopped during update"
}
# The location where the builds are checked and downloaded.

View File

@ -91,15 +91,18 @@ fn_update_mumble_compare(){
command_start.sh
exitbypass=1
command_stop.sh
fn_commandname
# If server started.
else
fn_stop_warning
exitbypass=1
command_stop.sh
fn_commandname
exitbypass=1
fn_update_mumble_dl
exitbypass=1
command_start.sh
fn_commandname
fi
date +%s > "${lockdir}/lastupdate.lock"
alert="update"
@ -118,18 +121,18 @@ fn_update_mumble_compare(){
}
fn_stop_warning(){
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_print_warn "this game server will be stopped during update"
fn_script_log_warn "this game server will be stopped during update"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}"
fn_print_warn "this game server will be stopped during update: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_print_warn_nl "this game server will be stopped during update"
}
# The location where the builds are checked and downloaded.

View File

@ -128,10 +128,12 @@ fn_update_steamcmd_compare(){
fn_stop_warning
exitbypass=1
command_stop.sh
fn_commandname
exitbypass=1
fn_update_steamcmd_dl
exitbypass=1
command_start.sh
fn_commandname
fi
date +%s > "${lockdir}/lastupdate.lock"
alert="update"
@ -206,18 +208,18 @@ fn_appmanifest_check(){
}
fn_stop_warning(){
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_script_log_warn "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_print_warn "this game server will be stopped during update"
fn_script_log_warn "this game server will be stopped during update"
totalseconds=3
for seconds in {3..1}; do
fn_print_warn "Updating server: SteamCMD: ${selfname} will be stopped during update: ${totalseconds}"
fn_print_warn "this game server will be stopped during update: ${totalseconds}"
totalseconds=$((totalseconds - 1))
sleep 1
if [ "${seconds}" == "0" ]; then
break
fi
done
fn_print_warn_nl "Updating server: SteamCMD: ${selfname} will be stopped during update"
fn_print_warn_nl "this game server will be stopped during update"
}
# The location where the builds are checked and downloaded.
@ -235,6 +237,7 @@ if [ "${forceupdate}" == "1" ]; then
date +%s > "${lockdir}/lastupdate.lock"
exitbypass=1
command_start.sh
fn_commandname
else
fn_update_steamcmd_dl
date +%s > "${lockdir}/lastupdate.lock"

View File

@ -44,6 +44,7 @@ fn_update_ts3_localbuild(){
command_stop.sh
exitbypass=1
command_start.sh
fn_commandname
totalseconds=0
# Check again, allow time to generate logs.
while [ ! -d "${serverfiles}/logs" ]||[ -z "$(find "${serverfiles}/logs/"* -name 'ts3server*_0.log' 2> /dev/null)" ]; do
@ -152,15 +153,18 @@ fn_update_ts3_compare(){
command_start.sh
exitbypass=1
command_stop.sh
fn_commandname
# If server started.
else
fn_stop_warning
exitbypass=1
command_stop.sh
fn_commandname
exitbypass=1
fn_update_ts3_dl
exitbypass=1
command_start.sh
fn_commandname
fi
date +%s > "${lockdir}/lastupdate.lock"
alert="update"

View File

@ -113,7 +113,7 @@ fn_bootstrap_fetch_file(){
fi
# On first try will error. On second try will fail.
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
if [ ${counter} -ge 2 ]; then
echo -e "FAIL"
if [ -f "${lgsmlog}" ]; then

View File

@ -119,7 +119,7 @@ fn_bootstrap_fetch_file(){
fi
# On first try will error. On second try will fail.
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
if [ ${counter} -ge 2 ]; then
echo -e "FAIL"
if [ -f "${lgsmlog}" ]; then
@ -389,7 +389,7 @@ else
echo -en "copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
echo -e "FAIL"
exit 1
else
@ -402,7 +402,7 @@ else
echo -en "copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
echo -e "FAIL"
exit 1
else

View File

@ -120,7 +120,7 @@ fn_bootstrap_fetch_file(){
fi
# On first try will error. On second try will fail.
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
if [ ${counter} -ge 2 ]; then
echo -e "FAIL"
if [ -f "${lgsmlog}" ]; then
@ -390,7 +390,7 @@ else
echo -en "copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
echo -e "FAIL"
exit 1
else
@ -403,7 +403,7 @@ else
echo -en "copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
echo -e "FAIL"
exit 1
else

View File

@ -120,7 +120,7 @@ fn_bootstrap_fetch_file(){
fi
# On first try will error. On second try will fail.
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
if [ ${counter} -ge 2 ]; then
echo -e "FAIL"
if [ -f "${lgsmlog}" ]; then
@ -390,7 +390,7 @@ else
echo -en "copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
echo -e "FAIL"
exit 1
else
@ -403,7 +403,7 @@ else
echo -en "copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
echo -e "FAIL"
exit 1
else

View File

@ -120,7 +120,7 @@ fn_bootstrap_fetch_file(){
fi
# On first try will error. On second try will fail.
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
if [ ${counter} -ge 2 ]; then
echo -e "FAIL"
if [ -f "${lgsmlog}" ]; then
@ -390,7 +390,7 @@ else
echo -en "copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
echo -e "FAIL"
exit 1
else
@ -403,7 +403,7 @@ else
echo -en "copying _default.cfg...\c"
cp -R "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" "${configdirserver}/_default.cfg"
exitcode=$?
if [ ${exitcode} -ne 0 ]; then
if [ "${exitcode}" != 0 ]; then
echo -e "FAIL"
exit 1
else