From cbb5bbe170062db001149a8ca1057ca95b33a5e4 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 2 Mar 2016 22:12:24 +0000 Subject: [PATCH] all nl messages will act the same most nl messages already waited 1 second before new line. however all should now do this giving a more consistent feel --- functions/check_logs.sh | 3 +-- functions/command_debug.sh | 4 +--- functions/command_start.sh | 6 +---- functions/command_stop.sh | 11 +++++---- functions/command_validate.sh | 4 +--- functions/core_messages.sh | 44 ++++++++++++++++++++++++----------- functions/email.sh | 6 ++--- functions/logs.sh | 12 +++------- 8 files changed, 46 insertions(+), 44 deletions(-) diff --git a/functions/check_logs.sh b/functions/check_logs.sh index f390eeab4..9b4f41324 100644 --- a/functions/check_logs.sh +++ b/functions/check_logs.sh @@ -10,8 +10,7 @@ lgsm_version="271215" if [ ! -d "${scriptlogdir}" ]; then fn_print_dots "Checking for log files" sleep 1 - fn_print_info "Checking for log files: Creating log files" - echo -en "\n" + fn_print_info_nl "Checking for log files: Creating log files" checklogs=1 install_logs.sh fi diff --git a/functions/command_debug.sh b/functions/command_debug.sh index 7c9aca38b..baa93aec0 100644 --- a/functions/command_debug.sh +++ b/functions/command_debug.sh @@ -48,10 +48,8 @@ sleep 1 command_stop.sh fn_print_dots "Starting debug" sleep 1 -fn_print_ok "Starting debug" +fn_print_ok_nl "Starting debug" fn_scriptlog "Started debug" -sleep 1 -echo -en "\n" cd "${executabledir}" fix.sh if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then diff --git a/functions/command_start.sh b/functions/command_start.sh index fd30a17bb..e1e324caf 100644 --- a/functions/command_start.sh +++ b/functions/command_start.sh @@ -104,10 +104,8 @@ if [ "${tmuxwc}" -eq 0 ]; then fi if [ "${tmuxwc}" -eq 1 ]; then - fn_print_info "${servername} is already running" + fn_print_info_nl "${servername} is already running" fn_scriptlog "${servername} is already running" - sleep 1 - echo -en "\n" exit fi @@ -138,8 +136,6 @@ if [ "${tmuxwc}" -eq 0 ]; then if [ -s "${scriptlogdir}/.${servicename}-tmux-error.tmp" ]; then fn_print_fail_nl "Unable to start ${servername}: Tmux error:" fn_scriptlog "Tmux error" - sleep 1 - echo -en "\n" echo "" echo "Command" echo "=================================" diff --git a/functions/command_stop.sh b/functions/command_stop.sh index a127ebc4b..3e6a7e398 100644 --- a/functions/command_stop.sh +++ b/functions/command_stop.sh @@ -150,17 +150,15 @@ fn_print_dots "${servername}" fn_scriptlog "${servername}" sleep 1 ${filesdir}/ts3server_startscript.sh stop > /dev/null 2>&1 -fn_print_ok "${servername}" -fn_scriptlog "Stopped ${servername}" # Remove lock file rm -f "${rootdir}/${lockselfname}" -sleep 1 -echo -en "\n" +fn_print_ok_nl "${servername}" +fn_scriptlog "Stopped ${servername}" } fn_stop_tmux(){ fn_print_dots "${servername}" -fn_scriptlog "${servername}" +fn_scriptlog "tmux kill-session: ${servername}" sleep 1 # Kill tmux session tmux kill-session -t "${servicename}" > /dev/null 2>&1 @@ -200,4 +198,7 @@ fi } check.sh +fn_print_dots "${servername}" +fn_scriptlog "${servername}" +sleep 1 fn_stop_pre_check \ No newline at end of file diff --git a/functions/command_validate.sh b/functions/command_validate.sh index 59c03b6ff..f4c46c071 100644 --- a/functions/command_validate.sh +++ b/functions/command_validate.sh @@ -10,9 +10,7 @@ local modulename="Validate" function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" fn_validation(){ -fn_print_warn "Validating may overwrite some customised files." -sleep 1 -echo -en "\n" +fn_print_warn_nl "Validating may overwrite some customised files." echo -en "https://developer.valvesoftware.com/wiki/SteamCMD#Validate" sleep 5 echo -en "\n" diff --git a/functions/core_messages.sh b/functions/core_messages.sh index eeaac4170..2cbcd08f7 100644 --- a/functions/core_messages.sh +++ b/functions/core_messages.sh @@ -30,10 +30,12 @@ fn_print_fail(){ fn_print_fail_nl(){ if [ -n "${modulename}" ]; then - echo -e "\r\033[K[\e[0;31m FAIL \e[0m] ${modulename} ${servicename}: $@" + echo -en "\r\033[K[\e[0;31m FAIL \e[0m] ${modulename} ${servicename}: $@" else - echo -e "\r\033[K[\e[0;31m FAIL \e[0m] $@" + echo -en "\r\033[K[\e[0;31m FAIL \e[0m] $@" fi + sleep 1 + echo -en "\n" } # [ OK ] @@ -47,10 +49,12 @@ fn_print_ok(){ fn_print_ok_nl(){ if [ -n "${modulename}" ]; then - echo -e "\r\033[K[\e[0;32m OK \e[0m] ${modulename} ${servicename}: $@" + echo -en "\r\033[K[\e[0;32m OK \e[0m] ${modulename} ${servicename}: $@" else - echo -e "\r\033[K[\e[0;32m OK \e[0m] $@" + echo -en "\r\033[K[\e[0;32m OK \e[0m] $@" fi + sleep 1 + echo -en "\n" } # [ INFO ] @@ -64,10 +68,12 @@ fn_print_info(){ fn_print_info_nl(){ if [ -n "${modulename}" ]; then - echo -e "\r\033[K[\e[0;36m INFO \e[0m] ${modulename} ${servicename}: $@" + echo -en "\r\033[K[\e[0;36m INFO \e[0m] ${modulename} ${servicename}: $@" else - echo -e "\r\033[K[\e[0;36m INFO \e[0m] $@" + echo -en "\r\033[K[\e[0;36m INFO \e[0m] $@" fi + sleep 1 + echo -en "\n" } # [ WARN ] @@ -81,10 +87,12 @@ fn_print_warn(){ fn_print_warn_nl(){ if [ -n "${modulename}" ]; then - echo -e "\r\033[K[\e[1;33m WARN \e[0m] ${modulename} ${servicename}: $@" + echo -en "\r\033[K[\e[1;33m WARN \e[0m] ${modulename} ${servicename}: $@" else - echo -e "\r\033[K[\e[1;33m WARN \e[0m] $@" + echo -en "\r\033[K[\e[1;33m WARN \e[0m] $@" fi + sleep 1 + echo -en "\n" } # [ .... ] @@ -120,7 +128,9 @@ fn_print_failure(){ } fn_print_failure_nl(){ - echo -e "\e[0;31mFailure!\e[0m $@" + echo -en "\e[0;31mFailure!\e[0m $@" + sleep 1 + echo -en "\n" } # Error! @@ -129,7 +139,9 @@ fn_print_error(){ } fn_print_error_nl(){ - echo -e "\e[0;31mError!\e[0m $@" + echo -en "\e[0;31mError!\e[0m $@" + sleep 1 + echo -en "\n" } # Info! @@ -138,7 +150,9 @@ fn_print_infomation(){ } fn_print_infomation_nl(){ - echo -e "\e[0;36mInfomation!\e[0m $@" + echo -en "\e[0;36mInfomation!\e[0m $@" + sleep 1 + echo -en "\n" } # FAIL for end of line @@ -147,7 +161,9 @@ fn_print_ok_eol(){ } fn_print_ok_eol_nl(){ - echo -e "\e[0;32mOK\e[0m" + echo -en "\e[0;32mOK\e[0m" + sleep 1 + echo -en "\n" } # FAIL for end of line @@ -156,7 +172,9 @@ fn_print_fail_eol(){ } fn_print_fail_eol_nl(){ - echo -e "\e[0;31mFAIL\e[0m" + echo -en "\e[0;31mFAIL\e[0m" + sleep 1 + echo -en "\n" } # QUERYING for end of line diff --git a/functions/email.sh b/functions/email.sh index 51b097dd9..174ed3ff6 100644 --- a/functions/email.sh +++ b/functions/email.sh @@ -64,7 +64,5 @@ if [ -n "${gamelogdir}" ]; then tail "${gamelogdir}"/* | grep -v "==>" | sed '/^$/d' | tail -25 >> "${emaillog}" fi mail -s "${subject}" ${email} < "${emaillog}" -fn_print_ok "Sending notification to ${email}" -fn_scriptlog "Sent notification to ${email}" -sleep 1 -echo -en "\n" +fn_print_ok_nl "Sending notification to ${email}" +fn_scriptlog "Sent notification to ${email}" \ No newline at end of file diff --git a/functions/logs.sh b/functions/logs.sh index 79d4de462..cb7bd805b 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -27,14 +27,10 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; th # Setting up counting variables scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" ; legacycount="0" sleep 1 - fn_print_ok "Starting" + fn_print_ok_nl "Starting" fn_scriptlog "Starting" - sleep 1 - echo -en "\n" - fn_print_info "Removing logs older than "${logdays}" days" + fn_print_info_nl "Removing logs older than "${logdays}" days" fn_scriptlog "Removing logs older than "${logdays}" days" - sleep 1 - echo -en "\n" # Logging logfiles to be removed according to "${logdays}", counting and removing them # Script logfiles find "${scriptlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}" @@ -90,8 +86,6 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; th # Count total amount of files removed count=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount} + ${legacycount})) # Job done - fn_print_ok "Removed ${count} log files" + fn_print_ok_nl "Removed ${count} log files" fn_scriptlog "Removed ${count} log files" - sleep 1 - echo -en "\n" fi