Browse Source
refactor: optimize sleep time function
The code changes refactor the sleep time function in multiple files to improve efficiency. The fn_sleep_time function is replaced with fn_sleep_time_1. This change reduces unnecessary delays during execution.
pull/4339/head
Daniel Gibbs
2 years ago
No known key found for this signature in database
GPG Key ID: 2076B128385E8C55
7 changed files with
9 additions and
11 deletions
lgsm/modules/command_backup.sh
lgsm/modules/command_fastdl.sh
lgsm/modules/command_mods_remove.sh
lgsm/modules/command_mods_update.sh
lgsm/modules/command_start.sh
lgsm/modules/install_gslt.sh
lgsm/modules/install_server_dir.sh
@ -187,7 +187,7 @@ fn_backup_prune() {
# Display how many backups will be cleared.
echo -e " * Pruning: ${ backupquotadiff } backup(s) has exceeded the ${ maxbackups } backups limit "
fn_script_log_info " Pruning: ${ backupquotadiff } backup(s) has exceeded the ${ maxbackups } backups limit "
fn_sleep_time
fn_sleep_time_1
fn_print_dots " Pruning: Clearing ${ backupquotadiff } backup(s) "
fn_script_log_info " Pruning: Clearing ${ backupquotadiff } backup(s) "
# Clear backups over quota.
@ -199,7 +199,7 @@ fn_backup_prune() {
# Display how many backups will be cleared.
echo -e " * Pruning: ${ backupsoudatedcount } backup(s) are older than ${ maxbackupdays } days. "
fn_script_log_info " Pruning: ${ backupsoudatedcount } backup(s) older than ${ maxbackupdays } days. "
fn_sleep_time
fn_sleep_time_1
fn_print_dots " Pruning: Clearing ${ backupquotadiff } backup(s). "
fn_script_log_info " Pruning: Clearing ${ backupquotadiff } backup(s) "
# Clear backups over quota
@ -291,7 +291,7 @@ fn_fastdl_gmod() {
# Correct content that may be into a lua directory by mistake like some darkrpmodification addons.
if [ -d " ${ fastdldir } /lua " ] ; then
echo -en "correcting DarkRP files..."
fn_sleep_time
fn_sleep_time_1
cp -Rf " ${ fastdldir } /lua/ " * " ${ fastdldir } "
exitcode = $?
if [ " ${ exitcode } " != 0 ] ; then
@ -335,7 +335,7 @@ fn_fastdl_source() {
tput rc
tput el
echo -e " copying ${ directory } ${ allowed_extention } : ${ fileswc } ... "
fn_sleep_time
fn_sleep_time_1
# get relative path of file in the dir
tmprelfilepath = " ${ fastdlfile # " ${ systemdir } / " } "
copytodir = " ${ tmprelfilepath %/* } "
@ -59,7 +59,7 @@ fn_script_log_info "Removing ${modsfilelistsize} files from ${modprettyname}"
echo -e " removing ${ modprettyname } "
echo -e " * ${ modsfilelistsize } files to be removed "
echo -e " * location: ${ modinstalldir } "
fn_sleep_time
fn_sleep_time_1
# Go through every file and remove it.
modfileline = "1"
tput sc
@ -99,7 +99,7 @@ fi
# Remove file list.
echo -en " removing ${ modcommand } -files.txt... "
fn_sleep_time
fn_sleep_time_1
rm -rf " ${ modsdir : ? } / ${ modcommand } -files.txt "
exitcode = $?
if [ " ${ exitcode } " != 0 ] ; then
@ -113,7 +113,7 @@ fi
# Remove mods from installed mods list.
echo -en " removing ${ modcommand } from ${ modsinstalledlist } ... "
fn_sleep_time
fn_sleep_time_1
sed -i " /^ ${ modcommand } $/d " " ${ modsinstalledlistfullpath } "
exitcode = $?
@ -18,7 +18,7 @@ mods_core.sh
fn_remove_cfg_files( ) {
if [ " ${ modkeepfiles } " != "OVERWRITE" ] && [ " ${ modkeepfiles } " != "NOUPDATE" ] ; then
echo -e "the following files/directories will be preserved:"
fn_sleep_time
fn_sleep_time_1
# Count how many files there are to remove.
filestopreserve = $( echo -e " ${ modkeepfiles } " | awk -F ';' '{ print NF }' )
# Test all subvalues of "modkeepfiles" using the ";" separator.
@ -114,7 +114,7 @@ fn_start_tmux() {
echo -e "Console logging disabled in settings" >> " ${ consolelog } "
fn_script_log_info "Console logging disabled by user"
fi
fn_sleep_time
fn_sleep_time_1
# If the server fails to start.
check_status.sh
@ -10,7 +10,6 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
echo -e ""
echo -e " ${ bold } ${ lightyellow } Game Server Login Token ${ default } "
fn_messages_separator
fn_sleep_time
if [ " ${ shortname } " = = "csgo" ] || [ " ${ shortname } " = = "css" ] || [ " ${ shortname } " = = "nmrih" ] || [ " ${ shortname } " = = "bs" ] ; then
echo -e " GSLT is required to run a public ${ gamename } server "
fn_script_log_info " GSLT is required to run a public ${ gamename } server "
@ -10,7 +10,6 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
echo -e ""
echo -e " ${ bold } ${ lightyellow } Server Directory ${ default } "
fn_messages_separator
fn_sleep_time
if [ -d " ${ serverfiles } " ] ; then
fn_print_warning_nl "A server is already installed here."
fi