From b4c6a2a407f22c20ef69aeb718dbdfde8038bbda Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 30 Jul 2023 23:32:47 +0100 Subject: [PATCH] refactor: refactor check_last_update.sh, command_backup.sh, command_debug.sh, command_mods_remove.sh, command_monitor.sh, command_start.sh, command_stop.sh, command_ts3_server_pass.sh and core_steamcmd.sh - Refactored code to improve readability and maintainability. - Renamed variables for clarity. - Removed unnecessary comments and unused code. - Fixed typos and formatting issues. --- lgsm/modules/check_last_update.sh | 6 ++--- lgsm/modules/command_backup.sh | 2 +- lgsm/modules/command_debug.sh | 2 +- lgsm/modules/command_mods_remove.sh | 2 +- lgsm/modules/command_monitor.sh | 32 +++++++++++------------- lgsm/modules/command_start.sh | 26 +++++++++++-------- lgsm/modules/command_stop.sh | 8 +++++- lgsm/modules/command_ts3_server_pass.sh | 4 +-- lgsm/modules/core_steamcmd.sh | 4 +-- lgsm/modules/update_factorio.sh | 4 +-- lgsm/modules/update_jediknight2.sh | 4 +-- lgsm/modules/update_minecraft.sh | 4 +-- lgsm/modules/update_minecraft_bedrock.sh | 4 +-- lgsm/modules/update_mta.sh | 4 +-- lgsm/modules/update_papermc.sh | 4 +-- lgsm/modules/update_steamcmd.sh | 4 +-- lgsm/modules/update_ts3.sh | 4 +-- lgsm/modules/update_ut99.sh | 4 +-- lgsm/modules/update_vintagestory.sh | 4 +-- 19 files changed, 67 insertions(+), 59 deletions(-) diff --git a/lgsm/modules/check_last_update.sh b/lgsm/modules/check_last_update.sh index 4e017567d..79e731e4c 100644 --- a/lgsm/modules/check_last_update.sh +++ b/lgsm/modules/check_last_update.sh @@ -11,12 +11,12 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ -f "${lockdir}/${selfname}-last-started.lock" ]; then laststart=$(cat "${lockdir}/${selfname}-last-started.lock") fi -if [ -f "${lockdir}/lastupdate.lock" ]; then - lastupdate=$(cat "${lockdir}/lastupdate.lock") +if [ -f last-updated.lock" ]; then + lastupdate=$(cat last-updated.lock") fi check_status.sh -if [ -f "${lockdir}/lastupdate.lock" ] && [ "${status}" != "0" ]; then +if [ -f last-updated.lock" ] && [ "${status}" != "0" ]; then if [ ! -f "${lockdir}/${selfname}-last-started.lock" ] || [ "${laststart}" -lt "${lastupdate}" ]; then fn_print_info "${selfname} has not been restarted since last update" fn_script_log_info "${selfname} has not been restarted since last update" diff --git a/lgsm/modules/command_backup.sh b/lgsm/modules/command_backup.sh index 5aa13f99b..b63c82625 100644 --- a/lgsm/modules/command_backup.sh +++ b/lgsm/modules/command_backup.sh @@ -129,7 +129,7 @@ fn_backup_migrate_olddir() { fn_backup_create_lockfile() { # Create lockfile. - date '+%s' > "${lockdir}/backup.lock" + date '+%s' > "${lockdir:?}/backup.lock" fn_script_log_info "Backup lockfile generated" fn_script_log_info "${lockdir}/backup.lock" # trap to remove lockfile on quit. diff --git a/lgsm/modules/command_debug.sh b/lgsm/modules/command_debug.sh index 00f965161..5adab241a 100644 --- a/lgsm/modules/command_debug.sh +++ b/lgsm/modules/command_debug.sh @@ -99,7 +99,7 @@ fn_script_log_info "Starting debug" fn_print_ok_nl "Starting debug" # Create lockfile. -date '+%s' > "${lockdir}/${selfname}-started.lock" +date '+%s' > "${lockdir:?}/${selfname}-started.lock" echo "${version}" >> "${lockdir}/${selfname}-started.lock" echo "${port}" >> "${lockdir}/${selfname}-started.lock" fn_script_log_info "Lockfile generated" diff --git a/lgsm/modules/command_mods_remove.sh b/lgsm/modules/command_mods_remove.sh index 08095c8e8..8f9ea3739 100644 --- a/lgsm/modules/command_mods_remove.sh +++ b/lgsm/modules/command_mods_remove.sh @@ -131,7 +131,7 @@ fi if [ "${engine}" == "unity3d" ] && [[ "${modprettyname}" == *"Oxide"* ]]; then fn_print_information_nl "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 fn_firstcommand_reset unset exitbypass diff --git a/lgsm/modules/command_monitor.sh b/lgsm/modules/command_monitor.sh index b93d1554c..c50ce4358 100644 --- a/lgsm/modules/command_monitor.sh +++ b/lgsm/modules/command_monitor.sh @@ -26,33 +26,31 @@ fn_monitor_check_lockfile() { # Fix if lockfile is not unix time or contains letters if [ -f "${lockdir}/${selfname}-started.lock" ] && [[ "$(head -n 1 "${lockdir}/${selfname}-started.lock")" =~ [A-Za-z] ]]; then - date '+%s' > "${lockdir}/${selfname}-started.lock" + date '+%s' > "${lockdir:?}/${selfname}-started.lock" echo "${version}" >> "${lockdir}/${selfname}-started.lock" echo "${port}" >> "${lockdir}/${selfname}-started.lock" fi } fn_monitor_check_install() { - # Monitor will check if update is running. if [ "$(pgrep -fc -u "${USER}" "${selfname} install")" != "0" ] || [ "$(pgrep -fc -u "${USER}" "${selfname} i")" != "0" ] || [ "$(pgrep -fc -u "${USER}" "${selfname} auto-install")" != "0" ] || [ "$(pgrep -fc -u "${USER}" "${selfname} ai")" != "0" ]; then fn_print_dots "Checking installer: " fn_print_checking_eol fn_script_log_info "Checking installer: CHECKING" - fn_print_info "Checking installer: LinuxGSM is currently installing: " + fn_print_info "Checking installer: Installer is : " fn_print_info_eol - fn_script_log_pass "Checking installer: LinuxGSM is currently installing" + fn_script_log_pass "Checking installer: LinuxGSM is installing" core_exit.sh fi } fn_monitor_check_debug() { - # Monitor will check if debug is running. if [ "$(pgrep -fc -u "${USER}" "${selfname} debug")" != "0" ] || [ "$(pgrep -fc -u "${USER}" "${selfname} d")" != "0" ]; then fn_print_dots "Checking debug: " fn_print_checking_eol - fn_print_info "Checking debug: LinuxGSM is currently in debug mode: " + fn_print_info "Checking debug: Debug is running: " fn_print_info_eol - fn_script_log_pass "Checking debug: LinuxGSM is currently in debug mode" + fn_script_log_pass "Checking debug: Debug is running" core_exit.sh fi } @@ -73,9 +71,9 @@ fn_monitor_check_starting(){ if [ -f "${lockdir}/starting.lock" ] && [[ "$(pgrep -fc -u "${USER}" "${selfname} start")" != "0" || "$(pgrep -fc -u "${USER}" "${selfname} s")" != "0" ]]; then fn_print_dots "Checking start: " fn_print_checking_eol - fn_print_info "Checking start: LinuxGSM is currently starting: " + fn_print_info "Checking start: LinuxGSM is starting: " fn_print_info_eol - fn_script_log_info "Checking backup: LinuxGSM is currently starting" + fn_script_log_info "Checking backup: LinuxGSM is starting" core_exit.sh fi } @@ -96,9 +94,9 @@ fn_monitor_check_stopping(){ if [ -f "${lockdir}/stopping.lock" ] && [[ "$(pgrep -fc -u "${USER}" "${selfname} stop")" != "0" || "$(pgrep -fc -u "${USER}" "${selfname} s")" != "0" ]]; then fn_print_dots "Checking stop: " fn_print_checking_eol - fn_print_info "Checking stop: LinuxGSM is currently stopping: " + fn_print_info "Checking stop: LinuxGSM is stopping: " fn_print_info_eol - fn_script_log_info "Checking backup: LinuxGSM is currently stopping" + fn_script_log_info "Checking backup: LinuxGSM is stopping" core_exit.sh fi } @@ -116,18 +114,16 @@ fn_monitor_check_backup() { fi fi - # Monitor will check if backup is running. if [ -f "${lockdir}/backup.lock" ] && [[ "$(pgrep -fc -u "${USER}" "${selfname} backup")" != "0" || "$(pgrep -fc -u "${USER}" "${selfname} b")" != "0" ]]; then fn_print_dots "Checking backup: " fn_print_checking_eol - fn_print_info "Checking backup: LinuxGSM is currently running a backup: " + fn_print_info "Checking backup: Backup is running: " fn_print_info_eol - fn_script_log_info "Checking backup: LinuxGSM is currently running a backup" + fn_script_log_info "Checking backup: Backup is running" core_exit.sh fi } -# This includes all update related commands. fn_monitor_check_update() { # Remove stale lockfile. if [ -f "${lockdir}/${selfname}-update.lock" ]; then @@ -144,13 +140,14 @@ fn_monitor_check_update() { if [ -f "${lockdir}/${selfname}-update.lock" ] && [[ "$(pgrep -fc -u "${USER}" "${selfname} update")" != "0" || "$(pgrep -fc -u "${USER}" "${selfname} validate")" != "0" || "$(pgrep -fc -u "${USER}" "${selfname} v")" != "0" || "$(pgrep -fc force-update "${USER}" "${selfname} fu")" != "0" ]]; then fn_print_dots "Checking update: " fn_print_checking_eol - fn_print_info_nl "Checking update: LinuxGSM is currently updating: " + fn_print_info_nl "Checking update: LinuxGSM is updating: " fn_print_info_eol - fn_script_log_pass "Checking update: LinuxGSM is currently updating" + fn_script_log_pass "Checking update: LinuxGSM is updating" core_exit.sh fi } +# Source engine games may display a messages to indicate the server needs restarting. fn_monitor_check_update_source(){ if [ -f "${consolelogdir}/${selfname}-console.log" ] && [ "${engine}" == "source" ]; then if grep -q "Your server needs to be restarted in order to receive the latest update." "${consolelogdir}/${selfname}-console.log"; then @@ -172,7 +169,6 @@ fn_monitor_check_session() { fn_print_dots "Checking session: " fn_print_checking_eol fn_script_log_info "Checking session: CHECKING" - # uses status var from check_status.sh if [ "${status}" != "0" ]; then fn_print_ok "Checking session: " fn_print_ok_eol_nl diff --git a/lgsm/modules/command_start.sh b/lgsm/modules/command_start.sh index 81b4df3f8..b9061be14 100644 --- a/lgsm/modules/command_start.sh +++ b/lgsm/modules/command_start.sh @@ -44,12 +44,7 @@ fn_start_tmux() { fi # Create a starting lockfile that only exists while the start command is running. - date '+%s' > "${lockdir}/${selfname}-starting.lock" - - # Create start lockfile that exists only when the server is running. - date '+%s' > "${lockdir}/${selfname}-started.lock" - echo "${version}" >> "${lockdir}/${selfname}-started.lock" - echo "${port}" >> "${lockdir}/${selfname}-started.lock" + date '+%s' > "${lockdir:?}/${selfname}-starting.lock" fn_reload_startparameters @@ -74,10 +69,6 @@ fn_start_tmux() { # Create logfile. touch "${consolelog}" - # Create last started Lockfile. - # TODO: should this be since last successful update? - date +%s > "${lockdir}/${selfname}-last-started.lock" - # tmux compiled from source will return "master", therefore ignore it. if [ "${tmuxv}" == "master" ]; then fn_script_log "tmux version: master (user compiled)" @@ -170,6 +161,16 @@ fn_start_tmux() { rm -f "${lockdir:?}/${selfname}-starting.lock" core_exit.sh else + # Create start lockfile that exists only when the server is running. + date '+%s' > "${lockdir:?}/${selfname}-started.lock" + echo "${version}" >> "${lockdir}/${selfname}-started.lock" + echo "${port}" >> "${lockdir}/${selfname}-started.lock" + fn_print_ok "${servername}" + fn_script_log_pass "Started ${servername}" + + # Create last started Lockfile. + date +%s > "${lockdir}/${selfname}-last-started.lock" + fn_print_ok "${servername}" fn_script_log_pass "Started ${servername}" fi @@ -179,6 +180,11 @@ fn_start_tmux() { check.sh +# If user ran the start command monitor will become enabled. +if [ -z "${exitbypass}" ]; then + date '+%s' > "${lockdir:?}/${selfname}-monitoring.lock" +fi + # If the server already started dont start again. if [ "${status}" != "0" ]; then fn_print_dots "${servername}" diff --git a/lgsm/modules/command_stop.sh b/lgsm/modules/command_stop.sh index 28840ef84..c2c12da2a 100644 --- a/lgsm/modules/command_stop.sh +++ b/lgsm/modules/command_stop.sh @@ -271,7 +271,7 @@ fn_stop_pre_check() { check.sh # Create a stopping lockfile that only exists while the stop command is running. -date '+%s' > "${lockdir}/${selfname}-stopping.lock" +date '+%s' > "${lockdir:?}/${selfname}-stopping.lock" fn_print_dots "${servername}" @@ -281,6 +281,12 @@ fn_stop_pre_check # Remove started lockfile. rm -f "${lockdir:?}/${selfname}-started.lock" +# If user ran the stop command monitor will become disabled. +if [ -z "${exitbypass}" ]; then + rm -f > "${lockdir:?}/${selfname}-monitoring.lock" +fi + + # Remove stopping lockfile. rm -f "${lockdir:?}/${selfname}-stopping.lock" diff --git a/lgsm/modules/command_ts3_server_pass.sh b/lgsm/modules/command_ts3_server_pass.sh index 4814ab142..0223a877c 100644 --- a/lgsm/modules/command_ts3_server_pass.sh +++ b/lgsm/modules/command_ts3_server_pass.sh @@ -28,7 +28,7 @@ fn_serveradmin_password_prompt() { fn_serveradmin_password_set() { # Start server in "new password mode". ts3serverpass="1" - exitbypass="1" + exitbypass=1 command_start.sh fn_firstcommand_reset fn_print_ok_nl "New password applied" @@ -40,7 +40,7 @@ check.sh fn_serveradmin_password_prompt if [ "${status}" != "0" ]; then # Stop any running server. - exitbypass="1" + exitbypass=1 command_stop.sh fn_firstcommand_reset fn_serveradmin_password_set diff --git a/lgsm/modules/core_steamcmd.sh b/lgsm/modules/core_steamcmd.sh index 99aad8695..1222623d1 100644 --- a/lgsm/modules/core_steamcmd.sh +++ b/lgsm/modules/core_steamcmd.sh @@ -207,7 +207,7 @@ fn_update_steamcmd_compare() { # Update has been found or force update. if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then # Create update lockfile. - date '+%s' > "${lockdir}/${selfname}-update.lock" + date '+%s' > "${lockdir:?}/${selfname}-update.lock" fn_print_ok_nl "Checking for update: ${remotelocation}" echo -en "\n" echo -e "Update available" @@ -251,7 +251,7 @@ fn_update_steamcmd_compare() { fn_firstcommand_reset fi unset exitbypass - date +%s > "${lockdir}/lastupdate.lock" + date +%s > last-updated.lock" alert="update" elif [ "${commandname}" == "CHECK-UPDATE" ]; then alert="check-update" diff --git a/lgsm/modules/update_factorio.sh b/lgsm/modules/update_factorio.sh index 458888519..df1067fc1 100644 --- a/lgsm/modules/update_factorio.sh +++ b/lgsm/modules/update_factorio.sh @@ -67,7 +67,7 @@ fn_update_compare() { # Update has been found or force update. if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then # Create update lockfile. - date '+%s' > "${lockdir}/${selfname}-update.lock" + date '+%s' > "${lockdir:?}/${selfname}-update.lock" fn_print_ok_nl "Checking for update: ${remotelocation}" echo -en "\n" echo -e "Update available" @@ -120,7 +120,7 @@ fn_update_compare() { fn_firstcommand_reset fi unset exitbypass - date +%s > "${lockdir}/lastupdate.lock" + date +%s > "${lockdir}/last-updated.lock" alert="update" elif [ "${commandname}" == "CHECK-UPDATE" ]; then alert="check-update" diff --git a/lgsm/modules/update_jediknight2.sh b/lgsm/modules/update_jediknight2.sh index ac87b0529..a2af2fc7b 100644 --- a/lgsm/modules/update_jediknight2.sh +++ b/lgsm/modules/update_jediknight2.sh @@ -64,7 +64,7 @@ fn_update_compare() { # Update has been found or force update. if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then # Create update lockfile. - date '+%s' > "${lockdir}/${selfname}-update.lock" + date '+%s' > "${lockdir:?}/${selfname}-update.lock" fn_print_ok_nl "Checking for update: ${remotelocation}" echo -en "\n" echo -e "Update available" @@ -117,7 +117,7 @@ fn_update_compare() { fn_firstcommand_reset fi unset exitbypass - date +%s > "${lockdir}/lastupdate.lock" + date +%s > "${lockdir}/last-updated.lock" alert="update" elif [ "${commandname}" == "CHECK-UPDATE" ]; then alert="check-update" diff --git a/lgsm/modules/update_minecraft.sh b/lgsm/modules/update_minecraft.sh index 429791818..8efc1e8f7 100644 --- a/lgsm/modules/update_minecraft.sh +++ b/lgsm/modules/update_minecraft.sh @@ -78,7 +78,7 @@ fn_update_compare() { # Update has been found or force update. if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then # Create update lockfile. - date '+%s' > "${lockdir}/${selfname}-update.lock" + date '+%s' > "${lockdir:?}/${selfname}-update.lock" fn_print_ok_nl "Checking for update: ${remotelocation}" echo -en "\n" echo -e "Update available" @@ -131,7 +131,7 @@ fn_update_compare() { fn_firstcommand_reset fi unset exitbypass - date +%s > "${lockdir}/lastupdate.lock" + date +%s > "${lockdir}/last-updated.lock" alert="update" elif [ "${commandname}" == "CHECK-UPDATE" ]; then alert="check-update" diff --git a/lgsm/modules/update_minecraft_bedrock.sh b/lgsm/modules/update_minecraft_bedrock.sh index f79b28496..768771926 100644 --- a/lgsm/modules/update_minecraft_bedrock.sh +++ b/lgsm/modules/update_minecraft_bedrock.sh @@ -83,7 +83,7 @@ fn_update_compare() { # Update has been found or force update. if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then # Create update lockfile. - date '+%s' > "${lockdir}/${selfname}-update.lock" + date '+%s' > "${lockdir:?}/${selfname}-update.lock" fn_print_ok_nl "Checking for update: ${remotelocation}" echo -en "\n" echo -e "Update available" @@ -136,7 +136,7 @@ fn_update_compare() { fn_firstcommand_reset fi unset exitbypass - date +%s > "${lockdir}/lastupdate.lock" + date +%s > "${lockdir}/last-updated.lock" alert="update" elif [ "${commandname}" == "CHECK-UPDATE" ]; then alert="check-update" diff --git a/lgsm/modules/update_mta.sh b/lgsm/modules/update_mta.sh index c7e821083..c25e5242e 100644 --- a/lgsm/modules/update_mta.sh +++ b/lgsm/modules/update_mta.sh @@ -62,7 +62,7 @@ fn_update_compare() { # Update has been found or force update. if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then # Create update lockfile. - date '+%s' > "${lockdir}/${selfname}-update.lock" + date '+%s' > "${lockdir:?}/${selfname}-update.lock" if [ "${forceupdate}" == "1" ]; then # forceupdate bypasses checks, useful for small build changes mtaupdatestatus="forced" @@ -121,7 +121,7 @@ fn_update_compare() { fn_firstcommand_reset fi unset exitbypass - date +%s > "${lockdir}/lastupdate.lock" + date +%s > "${lockdir}/last-updated.lock" alert="update" elif [ "${commandname}" == "CHECK-UPDATE" ]; then alert="check-update" diff --git a/lgsm/modules/update_papermc.sh b/lgsm/modules/update_papermc.sh index 7a23d6001..bce3aaedf 100644 --- a/lgsm/modules/update_papermc.sh +++ b/lgsm/modules/update_papermc.sh @@ -88,7 +88,7 @@ fn_update_compare() { # Update has been found or force update. if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then # Create update lockfile. - date '+%s' > "${lockdir}/${selfname}-update.lock" + date '+%s' > "${lockdir:?}/${selfname}-update.lock" fn_print_ok_nl "Checking for update: ${remotelocation}" echo -en "\n" echo -e "Update available" @@ -141,7 +141,7 @@ fn_update_compare() { fn_firstcommand_reset fi unset exitbypass - date +%s > "${lockdir}/lastupdate.lock" + date +%s > "${lockdir}/last-updated.lock" alert="update" elif [ "${commandname}" == "CHECK-UPDATE" ]; then alert="check-update" diff --git a/lgsm/modules/update_steamcmd.sh b/lgsm/modules/update_steamcmd.sh index 401da43a8..096859b97 100644 --- a/lgsm/modules/update_steamcmd.sh +++ b/lgsm/modules/update_steamcmd.sh @@ -24,13 +24,13 @@ if [ "${forceupdate}" == "1" ]; then command_stop.sh fn_firstcommand_reset fn_dl_steamcmd - date +%s > "${lockdir}/lastupdate.lock" + date +%s > "${lockdir}/last-updated.lock" exitbypass=1 command_start.sh fn_firstcommand_reset else fn_dl_steamcmd - date +%s > "${lockdir}/lastupdate.lock" + date +%s > "${lockdir}/last-updated.lock" fi else fn_update_steamcmd_localbuild diff --git a/lgsm/modules/update_ts3.sh b/lgsm/modules/update_ts3.sh index 3110e8e8f..a47ba1f74 100644 --- a/lgsm/modules/update_ts3.sh +++ b/lgsm/modules/update_ts3.sh @@ -71,7 +71,7 @@ fn_update_compare() { # Update has been found or force update. if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then # Create update lockfile. - date '+%s' > "${lockdir}/${selfname}-update.lock" + date '+%s' > "${lockdir:?}/${selfname}-update.lock" fn_print_ok_nl "Checking for update: ${remotelocation}" echo -en "\n" echo -e "Update available" @@ -124,7 +124,7 @@ fn_update_compare() { fn_firstcommand_reset fi unset exitbypass - date +%s > "${lockdir}/lastupdate.lock" + date +%s > "${lockdir}/last-updated.lock" alert="update" elif [ "${commandname}" == "CHECK-UPDATE" ]; then alert="check-update" diff --git a/lgsm/modules/update_ut99.sh b/lgsm/modules/update_ut99.sh index dce5db92b..c45ae990f 100644 --- a/lgsm/modules/update_ut99.sh +++ b/lgsm/modules/update_ut99.sh @@ -65,7 +65,7 @@ fn_update_compare() { # Update has been found or force update. if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then # Create update lockfile. - date '+%s' > "${lockdir}/${selfname}-update.lock" + date '+%s' > "${lockdir:?}/${selfname}-update.lock" fn_print_ok_nl "Checking for update: ${remotelocation}" echo -en "\n" echo -e "Update available" @@ -118,7 +118,7 @@ fn_update_compare() { fn_firstcommand_reset fi unset exitbypass - date +%s > "${lockdir}/lastupdate.lock" + date +%s > "${lockdir}/last-updated.lock" alert="update" elif [ "${commandname}" == "CHECK-UPDATE" ]; then alert="check-update" diff --git a/lgsm/modules/update_vintagestory.sh b/lgsm/modules/update_vintagestory.sh index ef0f87cc8..c87783f36 100644 --- a/lgsm/modules/update_vintagestory.sh +++ b/lgsm/modules/update_vintagestory.sh @@ -72,7 +72,7 @@ fn_update_compare() { # Update has been found or force update. if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then # Create update lockfile. - date '+%s' > "${lockdir}/${selfname}-update.lock" + date '+%s' > "${lockdir:?}/${selfname}-update.lock" fn_print_ok_nl "Checking for update: ${remotelocation}" echo -en "\n" echo -e "Update available" @@ -125,7 +125,7 @@ fn_update_compare() { fn_firstcommand_reset fi unset exitbypass - date +%s > "${lockdir}/lastupdate.lock" + date +%s > "${lockdir}/last-updated.lock" alert="update" elif [ "${commandname}" == "CHECK-UPDATE" ]; then alert="check-update"