Browse Source

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

bug: if a command calls another command then the log file will permanently change to the second command

this fix will revert the logs to state the primary command that was run
pull/2958/head
Daniel Gibbs 5 years ago
parent
commit
39e82d614a
  1. 19
      lgsm/functions/command_backup.sh
  2. 10
      lgsm/functions/command_console.sh
  3. 10
      lgsm/functions/command_debug.sh
  4. 3
      lgsm/functions/command_install.sh
  5. 5
      lgsm/functions/command_restart.sh
  6. 12
      lgsm/functions/command_start.sh
  7. 9
      lgsm/functions/command_update.sh
  8. 33
      lgsm/functions/command_validate.sh
  9. 331
      lgsm/functions/command_wipe.sh
  10. 4
      lgsm/functions/fix_kf.sh
  11. 2
      lgsm/functions/fix_kf2.sh
  12. 4
      lgsm/functions/fix_ro.sh
  13. 4
      lgsm/functions/fix_ut2k4.sh
  14. 2
      lgsm/functions/fix_ut3.sh
  15. 2
      lgsm/functions/fix_wurm.sh
  16. 12
      lgsm/functions/update_factorio.sh
  17. 10
      lgsm/functions/update_minecraft.sh
  18. 11
      lgsm/functions/update_minecraft_bedrock.sh
  19. 10
      lgsm/functions/update_mta.sh
  20. 12
      lgsm/functions/update_mumble.sh
  21. 10
      lgsm/functions/update_steamcmd.sh
  22. 6
      lgsm/functions/update_ts3.sh

19
lgsm/functions/command_backup.sh

@ -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
@ -77,6 +80,7 @@ fn_backup_stop_server(){
serverstopped="yes"
exitbypass=1
command_stop.sh
fn_commandname
fi
}
@ -247,18 +251,18 @@ 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.
@ -266,6 +270,7 @@ fn_backup_start_server(){
if [ "${serverstopped}" == "yes" ]; then
exitbypass=1
command_start.sh
fn_commandname
fi
}

10
lgsm/functions/command_console.sh

@ -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

10
lgsm/functions/command_debug.sh

@ -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"

3
lgsm/functions/command_install.sh

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

5
lgsm/functions/command_restart.sh

@ -4,13 +4,16 @@
# Website: https://linuxgsm.com
# Description: Restarts the server.
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

12
lgsm/functions/command_start.sh

@ -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}"

9
lgsm/functions/command_update.sh

@ -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

33
lgsm/functions/command_validate.sh

@ -4,23 +4,26 @@
# Website: https://linuxgsm.com
# Description: Runs a server validation.
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

331
lgsm/functions/command_wipe.sh

@ -5,29 +5,12 @@
# Website: https://linuxgsm.com
# Description: Wipes server data, useful after updates for some games like Rust
fn_commandname(){
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
# Provides an exit code upon error.
fn_wipe_exit_code(){
@ -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
echo -e "no blueprint file to remove"
fn_sleep_time
fn_script_log_pass "No blueprint file to remove"
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..."
elif [ "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]; then
echo -e "keeping blueprints"
fn_sleep_time
fn_script_log "${currentaction}"
find "${serveridentitydir:?}" -type f -name "Log.*.txt" -delete
fn_wipe_exit_code
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

4
lgsm/functions/fix_kf.sh

@ -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

2
lgsm/functions/fix_kf2.sh

@ -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

4
lgsm/functions/fix_ro.sh

@ -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

4
lgsm/functions/fix_ut2k4.sh

@ -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

2
lgsm/functions/fix_ut3.sh

@ -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

2
lgsm/functions/fix_wurm.sh

@ -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

12
lgsm/functions/update_factorio.sh

@ -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.

10
lgsm/functions/update_minecraft.sh

@ -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
@ -190,18 +192,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.

11
lgsm/functions/update_minecraft_bedrock.sh

@ -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
@ -150,18 +153,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.

10
lgsm/functions/update_mta.sh

@ -38,8 +38,10 @@ fn_update_mta_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}/mods/deathmatch/logs/server.log" ]; do
@ -181,18 +183,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.

12
lgsm/functions/update_mumble.sh

@ -89,17 +89,21 @@ fn_update_mumble_compare(){
fn_update_mumble_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_mumble_dl
exitbypass=1
command_start.sh
fn_commandname
fi
date +%s > "${lockdir}/lastupdate.lock"
alert="update"
@ -118,18 +122,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.

10
lgsm/functions/update_steamcmd.sh

@ -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.

6
lgsm/functions/update_ts3.sh

@ -42,8 +42,10 @@ fn_update_ts3_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 [ ! -d "${serverfiles}/logs" ]||[ -z "$(find "${serverfiles}/logs/"* -name 'ts3server*_0.log' 2> /dev/null)" ]; do
@ -150,17 +152,21 @@ fn_update_ts3_compare(){
fn_update_ts3_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_ts3_dl
exitbypass=1
command_start.sh
fn_commandname
fi
date +%s > "${lockdir}/lastupdate.lock"
alert="update"

Loading…
Cancel
Save