From 6d607a81a528e93b67762152d657d3504bd422c9 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 10 Oct 2023 20:29:21 +0100 Subject: [PATCH] change sleep to fn_sleep_time --- .github/workflows/serverlist-validate.sh | 2 +- lgsm/functions/check_status.sh | 2 +- lgsm/functions/command_stop.sh | 2 +- lgsm/modules/check_deps.sh | 16 ++++++++-------- lgsm/modules/command_monitor.sh | 2 +- lgsm/modules/command_stop.sh | 14 +++++++------- lgsm/modules/command_validate.sh | 2 +- lgsm/modules/command_wipe.sh | 4 ++-- lgsm/modules/core_messages.sh | 2 +- lgsm/modules/fix_kf.sh | 4 ++-- lgsm/modules/fix_kf2.sh | 2 +- lgsm/modules/fix_ro.sh | 4 ++-- lgsm/modules/fix_ut2k4.sh | 4 ++-- lgsm/modules/fix_ut3.sh | 2 +- lgsm/modules/install_eula.sh | 4 ++-- lgsm/modules/install_ts3db.sh | 2 +- lgsm/modules/update_fctr.sh | 2 +- lgsm/modules/update_jk2.sh | 2 +- lgsm/modules/update_mc.sh | 2 +- lgsm/modules/update_mcb.sh | 2 +- lgsm/modules/update_mta.sh | 2 +- lgsm/modules/update_pmc.sh | 2 +- lgsm/modules/update_ts3.sh | 2 +- lgsm/modules/update_ut99.sh | 2 +- lgsm/modules/update_vints.sh | 2 +- 25 files changed, 43 insertions(+), 43 deletions(-) diff --git a/.github/workflows/serverlist-validate.sh b/.github/workflows/serverlist-validate.sh index 50b2da7127..bc192ec378 100755 --- a/.github/workflows/serverlist-validate.sh +++ b/.github/workflows/serverlist-validate.sh @@ -10,7 +10,7 @@ csvlist="$(ls -1 | grep -E '^(ubuntu|debian|centos|rhel|almalinux|rocky).*\.csv$ # loop though each csv file and make sure the number of lines is the same as the serverlistcount for csv in $csvlist; do csvcount="$(wc -l < "${csv}")" - csvcount=$((csvcount-2)) + csvcount=$((csvcount - 2)) if [ "$csvcount" -ne "$serverlistcount" ]; then echo "ERROR: $csv ($csvcount) does not match serverlist.csv ($serverlistcount)" exitcode=1 diff --git a/lgsm/functions/check_status.sh b/lgsm/functions/check_status.sh index a454b4eff2..429f7c72dc 100644 --- a/lgsm/functions/check_status.sh +++ b/lgsm/functions/check_status.sh @@ -7,4 +7,4 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -status=$(tmux -L "${sessionname}" list-sessions -F "#{session_name}" 2>/dev/null | grep -Ecx "^${sessionname}") +status=$(tmux -L "${sessionname}" list-sessions -F "#{session_name}" 2> /dev/null | grep -Ecx "^${sessionname}") diff --git a/lgsm/functions/command_stop.sh b/lgsm/functions/command_stop.sh index d2e88fcea2..92785af98e 100644 --- a/lgsm/functions/command_stop.sh +++ b/lgsm/functions/command_stop.sh @@ -15,7 +15,7 @@ fn_stop_graceful_ctrlc() { fn_print_dots "Graceful: CTRL+c" fn_script_log_info "Graceful: CTRL+c" # Sends quit. - tmux -L "${sessionname}" send-keys -t "${sessionname}" C-c > /dev/null 2>&1 + tmux -L "${sessionname}" send-keys -t "${sessionname}" C-c > /dev/null 2>&1 # Waits up to 30 seconds giving the server time to shutdown gracefuly. for seconds in {1..30}; do check_status.sh diff --git a/lgsm/modules/check_deps.sh b/lgsm/modules/check_deps.sh index d10948ca53..83742208e1 100644 --- a/lgsm/modules/check_deps.sh +++ b/lgsm/modules/check_deps.sh @@ -25,11 +25,11 @@ fn_install_mono_repo() { fn_print_information_nl "Automatically adding Mono repository." fn_script_log_info "Automatically adding Mono repository." echo -en ".\r" - sleep 1 + fn_sleep_time_1 echo -en "..\r" - sleep 1 + fn_sleep_time_1 echo -en "...\r" - sleep 1 + fn_sleep_time_1 echo -en " \r" if [ "${distroid}" == "ubuntu" ]; then if [ "${distroversion}" == "22.04" ]; then @@ -177,11 +177,11 @@ fn_install_missing_deps() { fn_print_information_nl "Automatically installing missing dependencies." fn_script_log_info "Automatically installing missing dependencies." echo -en ".\r" - sleep 1 + fn_sleep_time_1 echo -en "..\r" - sleep 1 + fn_sleep_time_1 echo -en "...\r" - sleep 1 + fn_sleep_time_1 echo -en " \r" if [ "$(command -v apt 2> /dev/null)" ]; then cmd="echo steamcmd steam/question select \"I AGREE\" | sudo debconf-set-selections; echo steamcmd steam/license note '' | sudo debconf-set-selections; ${i386installcommand}sudo apt-get update; sudo apt-get -y install ${array_deps_missing[*]}" @@ -306,14 +306,14 @@ fn_deps_detector() { missingdep=0 if [ "${commandname}" == "INSTALL" ]; then echo -e "${green}${deptocheck}${default}" - sleep 0.1 + fn_sleep_time fi elif [ "${depstatus}" != "0" ]; then # If dependency is not found. missingdep=1 if [ "${commandname}" == "INSTALL" ]; then echo -e "${red}${deptocheck}${default}" - sleep 0.1 + fn_sleep_time fi # If SteamCMD requirements are not met install will fail. if [ -n "${appid}" ]; then diff --git a/lgsm/modules/command_monitor.sh b/lgsm/modules/command_monitor.sh index 079ad334d3..f8ceb849f8 100644 --- a/lgsm/modules/command_monitor.sh +++ b/lgsm/modules/command_monitor.sh @@ -330,7 +330,7 @@ fn_monitor_query() { # Second counter will wait for 15s before breaking loop. for seconds in {1..15}; do fn_print_fail "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt} : ${cyan}WAIT${default}" - sleep 0.5 + fn_sleep_time_1 totalseconds=$((totalseconds + 1)) if [ "${seconds}" == "15" ]; then break diff --git a/lgsm/modules/command_stop.sh b/lgsm/modules/command_stop.sh index ee91528629..430f8a0302 100644 --- a/lgsm/modules/command_stop.sh +++ b/lgsm/modules/command_stop.sh @@ -25,7 +25,7 @@ fn_stop_graceful_ctrlc() { fn_script_log_pass "Graceful: CTRL+c: OK: ${seconds} seconds" break fi - sleep 1 + fn_sleep_time_1 fn_print_dots "Graceful: CTRL+c: ${seconds}" done check_status.sh @@ -53,7 +53,7 @@ fn_stop_graceful_cmd() { fn_script_log_pass "Graceful: sending \"${1}\": OK: ${seconds} seconds" break fi - sleep 1 + fn_sleep_time_1 fn_print_dots "Graceful: sending \"${1}\": ${seconds}" done check_status.sh @@ -74,7 +74,7 @@ fn_stop_graceful_goldsrc() { tmux -L "${socketname}" send -t "${sessionname}" quit ENTER > /dev/null 2>&1 # Waits 3 seconds as goldsrc servers restart with the quit command. for seconds in {1..3}; do - sleep 1 + fn_sleep_time_1 fn_print_dots "Graceful: sending \"quit\": ${seconds}" done fn_print_ok "Graceful: sending \"quit\": ${seconds}: " @@ -154,7 +154,7 @@ fn_stop_graceful_sdtd() { fn_script_log_pass "Graceful: telnet: ${telnetip}:${telnetport} : ${seconds} seconds" break fi - sleep 1 + fn_sleep_time_1 fn_print_dots "Graceful: telnet: ${seconds}" done # If telnet shutdown fails tmux shutdown will be used, this risks loss of world save. @@ -185,7 +185,7 @@ fn_stop_graceful_avorion() { fn_script_log_info "Graceful: /save /stop" # Sends /save. tmux -L "${socketname}" send-keys -t "${sessionname}" /save ENTER > /dev/null 2>&1 - sleep 5 + fn_sleep_time_5 # Sends /quit. tmux -L "${socketname}" send-keys -t "${sessionname}" /stop ENTER > /dev/null 2>&1 # Waits up to 30 seconds giving the server time to shutdown gracefuly. @@ -197,7 +197,7 @@ fn_stop_graceful_avorion() { fn_script_log_pass "Graceful: /save /stop: OK: ${seconds} seconds" break fi - sleep 1 + fn_sleep_time_1 fn_print_dots "Graceful: /save /stop: ${seconds}" done check_status.sh @@ -241,7 +241,7 @@ fn_stop_tmux() { fn_script_log_info "tmux kill-session: ${sessionname}: ${servername}" # Kill tmux session. tmux -L "${socketname}" kill-session -t "${sessionname}" > /dev/null 2>&1 - sleep 0.5 + fn_sleep_time_1 check_status.sh if [ "${status}" == "0" ]; then fn_print_ok_nl "${servername}" diff --git a/lgsm/modules/command_validate.sh b/lgsm/modules/command_validate.sh index f4a6250f33..a512fa9627 100644 --- a/lgsm/modules/command_validate.sh +++ b/lgsm/modules/command_validate.sh @@ -17,7 +17,7 @@ fn_validate() { for seconds in {3..1}; do fn_print_warn "Validate might overwrite some customised files: ${totalseconds}" totalseconds=$((totalseconds - 1)) - sleep 1 + fn_sleep_time_1 if [ "${seconds}" == "0" ]; then break fi diff --git a/lgsm/modules/command_wipe.sh b/lgsm/modules/command_wipe.sh index 193d2cd2dd..589f2ca6b3 100644 --- a/lgsm/modules/command_wipe.sh +++ b/lgsm/modules/command_wipe.sh @@ -81,7 +81,7 @@ fn_map_wipe_warning() { for seconds in {3..1}; do fn_print_warn "Map wipe will reset the map data and keep blueprint data: ${totalseconds}" totalseconds=$((totalseconds - 1)) - sleep 1 + fn_sleep_time_1 if [ "${seconds}" == "0" ]; then break fi @@ -96,7 +96,7 @@ fn_full_wipe_warning() { for seconds in {3..1}; do fn_print_warn "Server wipe will reset the map data and remove blueprint data: ${totalseconds}" totalseconds=$((totalseconds - 1)) - sleep 1 + fn_sleep_time_1 if [ "${seconds}" == "0" ]; then break fi diff --git a/lgsm/modules/core_messages.sh b/lgsm/modules/core_messages.sh index b472c9ded0..e451ddb603 100644 --- a/lgsm/modules/core_messages.sh +++ b/lgsm/modules/core_messages.sh @@ -589,7 +589,7 @@ fn_print_restart_warning() { for seconds in {3..1}; do fn_print_warn "${selfname} will be restarted: ${totalseconds}" totalseconds=$((totalseconds - 1)) - sleep 1 + fn_sleep_time_1 if [ "${seconds}" == "0" ]; then break fi diff --git a/lgsm/modules/fix_kf.sh b/lgsm/modules/fix_kf.sh index fe8b574aac..c46cc48913 100644 --- a/lgsm/modules/fix_kf.sh +++ b/lgsm/modules/fix_kf.sh @@ -23,14 +23,14 @@ fn_sleep_time exitbypass=1 command_start.sh fn_firstcommand_reset -sleep 5 +fn_sleep_time_5 exitbypass=1 command_stop.sh fn_firstcommand_reset exitbypass=1 command_start.sh fn_firstcommand_reset -sleep 5 +fn_sleep_time_5 exitbypass=1 command_stop.sh fn_firstcommand_reset diff --git a/lgsm/modules/fix_kf2.sh b/lgsm/modules/fix_kf2.sh index 13176d4487..cb4707414e 100644 --- a/lgsm/modules/fix_kf2.sh +++ b/lgsm/modules/fix_kf2.sh @@ -13,7 +13,7 @@ fn_print_information "starting ${gamename} server to generate configs." exitbypass=1 command_start.sh fn_firstcommand_reset -sleep 10 +fn_sleep_time_10 exitbypass=1 command_stop.sh fn_firstcommand_reset diff --git a/lgsm/modules/fix_ro.sh b/lgsm/modules/fix_ro.sh index 6ae485dbe9..1d5e4512f9 100644 --- a/lgsm/modules/fix_ro.sh +++ b/lgsm/modules/fix_ro.sh @@ -26,14 +26,14 @@ fn_sleep_time exitbypass=1 command_start.sh fn_firstcommand_reset -sleep 5 +fn_sleep_time_5 exitbypass=1 command_stop.sh fn_firstcommand_reset exitbypass=1 command_start.sh fn_firstcommand_reset -sleep 5 +fn_sleep_time_5 exitbypass=1 command_stop.sh fn_firstcommand_reset diff --git a/lgsm/modules/fix_ut2k4.sh b/lgsm/modules/fix_ut2k4.sh index 2f7fc0d4d8..5da1eee127 100644 --- a/lgsm/modules/fix_ut2k4.sh +++ b/lgsm/modules/fix_ut2k4.sh @@ -23,14 +23,14 @@ fn_sleep_time exitbypass=1 command_start.sh fn_firstcommand_reset -sleep 5 +fn_sleep_time_5 exitbypass=1 command_stop.sh fn_firstcommand_reset exitbypass=1 command_start.sh fn_firstcommand_reset -sleep 5 +fn_sleep_time_5 exitbypass=1 command_stop.sh fn_firstcommand_reset diff --git a/lgsm/modules/fix_ut3.sh b/lgsm/modules/fix_ut3.sh index d725de4a2d..386833efc2 100644 --- a/lgsm/modules/fix_ut3.sh +++ b/lgsm/modules/fix_ut3.sh @@ -13,7 +13,7 @@ fn_print_information "starting ${gamename} server to generate configs." exitbypass=1 command_start.sh fn_firstcommand_reset -sleep 10 +fn_sleep_time_10 exitbypass=1 command_stop.sh fn_firstcommand_reset diff --git a/lgsm/modules/install_eula.sh b/lgsm/modules/install_eula.sh index 7f0229bfa2..7f7f95f353 100644 --- a/lgsm/modules/install_eula.sh +++ b/lgsm/modules/install_eula.sh @@ -30,10 +30,10 @@ if [ -z "${autoinstall}" ]; then fi elif [ "${commandname}" == "START" ]; then fn_print_info "By continuing you are indicating your agreement to the EULA." - sleep 5 + fn_sleep_time_5 else echo -e "By using auto-install you are indicating your agreement to the EULA." - sleep 5 + fn_sleep_time_5 fi if [ "${shortname}" == "ts3" ]; then diff --git a/lgsm/modules/install_ts3db.sh b/lgsm/modules/install_ts3db.sh index e5776c30f8..b88099183e 100644 --- a/lgsm/modules/install_ts3db.sh +++ b/lgsm/modules/install_ts3db.sh @@ -69,5 +69,5 @@ fn_print_information_nl "Key also saved in:" echo -e "${serverfiles}/privilege_key.txt" cd "${executabledir}" || exit ./ts3server_startscript.sh start inifile=ts3-server.ini 2>&1 | tee "${serverfiles}/privilege_key.txt" -sleep 5 +fn_sleep_time_5 ./ts3server_startscript.sh stop diff --git a/lgsm/modules/update_fctr.sh b/lgsm/modules/update_fctr.sh index 2eef0d4cd1..8fb78ede3c 100644 --- a/lgsm/modules/update_fctr.sh +++ b/lgsm/modules/update_fctr.sh @@ -104,7 +104,7 @@ fn_update_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 - sleep 5 + fn_sleep_time_5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/modules/update_jk2.sh b/lgsm/modules/update_jk2.sh index f685fd4cb9..e2715c01cb 100644 --- a/lgsm/modules/update_jk2.sh +++ b/lgsm/modules/update_jk2.sh @@ -100,7 +100,7 @@ fn_update_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 - sleep 5 + fn_sleep_time_5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/modules/update_mc.sh b/lgsm/modules/update_mc.sh index c4aa1b425c..4a0bdde37e 100644 --- a/lgsm/modules/update_mc.sh +++ b/lgsm/modules/update_mc.sh @@ -116,7 +116,7 @@ fn_update_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 - sleep 5 + fn_sleep_time_5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/modules/update_mcb.sh b/lgsm/modules/update_mcb.sh index eb8adfd12c..7bd273d669 100644 --- a/lgsm/modules/update_mcb.sh +++ b/lgsm/modules/update_mcb.sh @@ -122,7 +122,7 @@ fn_update_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 - sleep 5 + fn_sleep_time_5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/modules/update_mta.sh b/lgsm/modules/update_mta.sh index cd11955639..c6f7dfcb0c 100644 --- a/lgsm/modules/update_mta.sh +++ b/lgsm/modules/update_mta.sh @@ -108,7 +108,7 @@ fn_update_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 - sleep 5 + fn_sleep_time_5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/modules/update_pmc.sh b/lgsm/modules/update_pmc.sh index 9bfa82101e..5d44bee213 100644 --- a/lgsm/modules/update_pmc.sh +++ b/lgsm/modules/update_pmc.sh @@ -126,7 +126,7 @@ fn_update_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 - sleep 5 + fn_sleep_time_5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/modules/update_ts3.sh b/lgsm/modules/update_ts3.sh index c00ae75cba..1fa77f428f 100644 --- a/lgsm/modules/update_ts3.sh +++ b/lgsm/modules/update_ts3.sh @@ -108,7 +108,7 @@ fn_update_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 - sleep 5 + fn_sleep_time_5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/modules/update_ut99.sh b/lgsm/modules/update_ut99.sh index bdd3631f39..6d0be1941a 100644 --- a/lgsm/modules/update_ut99.sh +++ b/lgsm/modules/update_ut99.sh @@ -102,7 +102,7 @@ fn_update_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 - sleep 5 + fn_sleep_time_5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/modules/update_vints.sh b/lgsm/modules/update_vints.sh index b383720588..403917e0c1 100644 --- a/lgsm/modules/update_vints.sh +++ b/lgsm/modules/update_vints.sh @@ -109,7 +109,7 @@ fn_update_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 - sleep 5 + fn_sleep_time_5 command_stop.sh fn_firstcommand_reset fi