Browse Source

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
pull/743/head
Daniel Gibbs 9 years ago
parent
commit
cbb5bbe170
  1. 3
      functions/check_logs.sh
  2. 4
      functions/command_debug.sh
  3. 6
      functions/command_start.sh
  4. 11
      functions/command_stop.sh
  5. 4
      functions/command_validate.sh
  6. 44
      functions/core_messages.sh
  7. 6
      functions/email.sh
  8. 12
      functions/logs.sh

3
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

4
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

6
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 "================================="

11
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

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

44
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

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

12
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

Loading…
Cancel
Save