Browse Source

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

pull/2960/head
Daniel Gibbs 5 years ago
committed by GitHub
parent
commit
8316d87853
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      lgsm/functions/alert.sh
  2. 1
      lgsm/functions/check_last_update.sh
  3. 2
      lgsm/functions/check_steamcmd.sh
  4. 1
      lgsm/functions/check_version.sh
  5. 38
      lgsm/functions/command_backup.sh
  6. 10
      lgsm/functions/command_console.sh
  7. 10
      lgsm/functions/command_debug.sh
  8. 9
      lgsm/functions/command_details.sh
  9. 9
      lgsm/functions/command_dev_clear_functions.sh
  10. 9
      lgsm/functions/command_dev_debug.sh
  11. 9
      lgsm/functions/command_dev_detect_deps.sh
  12. 9
      lgsm/functions/command_dev_detect_glibc.sh
  13. 9
      lgsm/functions/command_dev_detect_ldd.sh
  14. 9
      lgsm/functions/command_dev_query_raw.sh
  15. 9
      lgsm/functions/command_donate.sh
  16. 31
      lgsm/functions/command_fastdl.sh
  17. 10
      lgsm/functions/command_install.sh
  18. 9
      lgsm/functions/command_install_resources_mta.sh
  19. 9
      lgsm/functions/command_mods_install.sh
  20. 18
      lgsm/functions/command_mods_remove.sh
  21. 9
      lgsm/functions/command_mods_update.sh
  22. 10
      lgsm/functions/command_monitor.sh
  23. 9
      lgsm/functions/command_postdetails.sh
  24. 11
      lgsm/functions/command_restart.sh
  25. 12
      lgsm/functions/command_start.sh
  26. 9
      lgsm/functions/command_stop.sh
  27. 9
      lgsm/functions/command_test_alert.sh
  28. 13
      lgsm/functions/command_ts3_server_pass.sh
  29. 9
      lgsm/functions/command_update.sh
  30. 9
      lgsm/functions/command_update_linuxgsm.sh
  31. 39
      lgsm/functions/command_validate.sh
  32. 339
      lgsm/functions/command_wipe.sh
  33. 9
      lgsm/functions/compress_unreal2_maps.sh
  34. 9
      lgsm/functions/compress_ut99_maps.sh
  35. 6
      lgsm/functions/core_dl.sh
  36. 4
      lgsm/functions/fix_kf.sh
  37. 2
      lgsm/functions/fix_kf2.sh
  38. 4
      lgsm/functions/fix_ro.sh
  39. 4
      lgsm/functions/fix_ut2k4.sh
  40. 2
      lgsm/functions/fix_ut3.sh
  41. 2
      lgsm/functions/fix_wurm.sh
  42. 4
      lgsm/functions/info_messages.sh
  43. 1
      lgsm/functions/install_modules.sh
  44. 16
      lgsm/functions/mods_core.sh
  45. 12
      lgsm/functions/update_factorio.sh
  46. 13
      lgsm/functions/update_minecraft.sh
  47. 14
      lgsm/functions/update_minecraft_bedrock.sh
  48. 12
      lgsm/functions/update_mta.sh
  49. 11
      lgsm/functions/update_mumble.sh
  50. 11
      lgsm/functions/update_steamcmd.sh
  51. 4
      lgsm/functions/update_ts3.sh
  52. 2
      linuxgsm.sh
  53. 6
      tests/tests_fctrserver.sh
  54. 6
      tests/tests_jc2server.sh
  55. 6
      tests/tests_mcserver.sh
  56. 6
      tests/tests_ts3server.sh

1
lgsm/functions/alert.sh

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

1
lgsm/functions/check_last_update.sh

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

2
lgsm/functions/check_steamcmd.sh

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

1
lgsm/functions/check_version.sh

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

38
lgsm/functions/command_backup.sh

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

10
lgsm/functions/command_console.sh

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

10
lgsm/functions/command_debug.sh

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

9
lgsm/functions/command_details.sh

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

9
lgsm/functions/command_dev_clear_functions.sh

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

9
lgsm/functions/command_dev_debug.sh

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

9
lgsm/functions/command_dev_detect_deps.sh

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

9
lgsm/functions/command_dev_detect_glibc.sh

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

9
lgsm/functions/command_dev_detect_ldd.sh

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

9
lgsm/functions/command_dev_query_raw.sh

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

9
lgsm/functions/command_donate.sh

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

31
lgsm/functions/command_fastdl.sh

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

10
lgsm/functions/command_install.sh

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

9
lgsm/functions/command_install_resources_mta.sh

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

9
lgsm/functions/command_mods_install.sh

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

18
lgsm/functions/command_mods_remove.sh

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

9
lgsm/functions/command_mods_update.sh

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

10
lgsm/functions/command_monitor.sh

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

9
lgsm/functions/command_postdetails.sh

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

11
lgsm/functions/command_restart.sh

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

12
lgsm/functions/command_start.sh

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

9
lgsm/functions/command_stop.sh

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

9
lgsm/functions/command_test_alert.sh

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

13
lgsm/functions/command_ts3_server_pass.sh

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

9
lgsm/functions/command_update.sh

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

9
lgsm/functions/command_update_linuxgsm.sh

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

39
lgsm/functions/command_validate.sh

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

339
lgsm/functions/command_wipe.sh

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

9
lgsm/functions/compress_unreal2_maps.sh

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

9
lgsm/functions/compress_ut99_maps.sh

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

6
lgsm/functions/core_dl.sh

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

4
lgsm/functions/fix_kf.sh

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

2
lgsm/functions/fix_kf2.sh

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

4
lgsm/functions/fix_ro.sh

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

4
lgsm/functions/fix_ut2k4.sh

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

2
lgsm/functions/fix_ut3.sh

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

2
lgsm/functions/fix_wurm.sh

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

4
lgsm/functions/info_messages.sh

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

1
lgsm/functions/install_modules.sh

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

16
lgsm/functions/mods_core.sh

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

12
lgsm/functions/update_factorio.sh

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

13
lgsm/functions/update_minecraft.sh

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

14
lgsm/functions/update_minecraft_bedrock.sh

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

12
lgsm/functions/update_mta.sh

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

11
lgsm/functions/update_mumble.sh

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

11
lgsm/functions/update_steamcmd.sh

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

4
lgsm/functions/update_ts3.sh

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

2
linuxgsm.sh

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

6
tests/tests_fctrserver.sh

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

6
tests/tests_jc2server.sh

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

6
tests/tests_mcserver.sh

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

6
tests/tests_ts3server.sh

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

Loading…
Cancel
Save