From ece19b33550a2632b43e3a9aee1ed0a3a98eebd4 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 28 Feb 2016 16:01:33 +0000 Subject: [PATCH] Updated messages func names Update al messages function names to make is easier to read --- functions/check_config.sh | 2 +- functions/check_deps.sh | 8 +-- functions/check_ip.sh | 2 +- functions/check_logs.sh | 4 +- functions/check_root.sh | 2 +- functions/check_steamcmd.sh | 12 ++--- functions/check_system_dir.sh | 2 +- functions/check_tmux.sh | 2 +- functions/command_backup.sh | 4 +- functions/command_console.sh | 8 +-- functions/command_debug.sh | 8 +-- functions/command_details.sh | 2 +- functions/command_dev_debug.sh | 4 +- functions/command_email_test.sh | 2 +- functions/command_monitor.sh | 26 +++++----- functions/command_start.sh | 20 ++++---- functions/command_stop.sh | 38 +++++++------- functions/command_ts3_server_pass.sh | 10 ++-- functions/command_update_functions.sh | 8 +-- functions/command_validate.sh | 6 +-- functions/core_dl.sh | 18 +++---- functions/core_messages.sh | 73 ++++++++++++++------------- functions/email.sh | 4 +- functions/fix_arma3.sh | 8 +-- functions/fix_csgo.sh | 8 +-- functions/fix_dst.sh | 8 +-- functions/fix_glibc.sh | 4 +- functions/fix_steamcmd.sh | 8 +-- functions/fn_update_functions | 6 +-- functions/install_server_dir.sh | 2 +- functions/install_server_files.sh | 6 +-- functions/install_ts3.sh | 6 +-- functions/install_ts3db.sh | 2 +- functions/logs.sh | 8 +-- functions/monitor_gsquery.sh | 20 ++++---- functions/update_check.sh | 54 ++++++++++---------- functions/update_dl.sh | 4 +- tests/tests_jc2server.sh | 12 ++--- tests/tests_ts3server.sh | 6 +-- 39 files changed, 215 insertions(+), 212 deletions(-) diff --git a/functions/check_config.sh b/functions/check_config.sh index 24d32318f..c329cca95 100644 --- a/functions/check_config.sh +++ b/functions/check_config.sh @@ -8,7 +8,7 @@ lgsm_version="060116" if [ ! -e "${servercfgfullpath}" ]; then if [ "${gamename}" != "Hurtworld" ]; then - fn_printwarnnl "Config file missing!" + fn_print_warn_nl "Config file missing!" echo "${servercfgfullpath}" fn_scriptlog "Configuration file missing!" fn_scriptlog "${servercfgfullpath}" diff --git a/functions/check_deps.sh b/functions/check_deps.sh index d562369a8..3cd5d32ce 100644 --- a/functions/check_deps.sh +++ b/functions/check_deps.sh @@ -50,15 +50,15 @@ fi fn_found_missing_deps(){ if [ "${#array_deps_missing[@]}" != "0" ]; then - fn_printdots "Checking dependencies" + fn_print_dots "Checking dependencies" sleep 2 - fn_printwarn "Checking dependencies: Dependency missing: \e[0;31m${array_deps_missing[@]}\e[0m" + fn_print_warn "Checking dependencies: Dependency missing: \e[0;31m${array_deps_missing[@]}\e[0m" fn_scriptlog "Checking dependencies: Dependency missing: \e[0;31m${array_deps_missing[@]}\e[0m" sleep 1 echo -e "" sudo -n true > /dev/null 2>&1 if [ $? -eq 0 ]; then - fn_printinfonl "Attempting to install missing dependencies automatically" + fn_print_info_nl "Attempting to install missing dependencies automatically" echo -en ".\r" sleep 1 echo -en "..\r" @@ -73,7 +73,7 @@ if [ "${#array_deps_missing[@]}" != "0" ]; then fi else echo "" - fn_printinfomationnl "$(whoami) does not have sudo access. manually install dependencies" + fn_print_infomation_nl "$(whoami) does not have sudo access. manually install dependencies" fn_scriptlog "$(whoami) does not have sudo access. manually install dependencies" echo "" if [ -n "$(command -v dpkg-query)" ]; then diff --git a/functions/check_ip.sh b/functions/check_ip.sh index 3e7e86cd3..c4b5be149 100644 --- a/functions/check_ip.sh +++ b/functions/check_ip.sh @@ -20,7 +20,7 @@ else if [ "${ip}" == "0.0.0.0" ]||[ "${ip}" == "" ]; then if [ "${getipwc}" -ge "2" ]; then - fn_printwarn "Multiple active network interfaces found.\n\n" + fn_print_warn "Multiple active network interfaces found.\n\n" echo -en "Manually specify the IP you want to use within the ${selfname} script.\n" echo -en "Set ip=\"0.0.0.0\" to one of the following:\n" echo -en "${getip}\n" diff --git a/functions/check_logs.sh b/functions/check_logs.sh index 92ed2cad1..f390eeab4 100644 --- a/functions/check_logs.sh +++ b/functions/check_logs.sh @@ -8,9 +8,9 @@ lgsm_version="271215" # Create dir's for the script and console logs if [ ! -d "${scriptlogdir}" ]; then - fn_printdots "Checking for log files" + fn_print_dots "Checking for log files" sleep 1 - fn_printinfo "Checking for log files: Creating log files" + fn_print_info "Checking for log files: Creating log files" echo -en "\n" checklogs=1 install_logs.sh diff --git a/functions/check_root.sh b/functions/check_root.sh index 8f2e5ed54..1a37cef57 100644 --- a/functions/check_root.sh +++ b/functions/check_root.sh @@ -5,7 +5,7 @@ lgsm_version="271215" if [ $(whoami) = "root" ]; then - fn_printfailnl "Do NOT run this script as root!" + fn_print_fail_nl "Do NOT run this script as root!" if [ -d "${scriptlogdir}" ]; then fn_scriptlog "${selfname} attempted to run as root." fi diff --git a/functions/check_steamcmd.sh b/functions/check_steamcmd.sh index 760b0b835..4039c4ef8 100644 --- a/functions/check_steamcmd.sh +++ b/functions/check_steamcmd.sh @@ -20,7 +20,7 @@ chmod +x "${steamcmddir}/steamcmd.sh" fn_check_steamcmd_user(){ # Checks steamuser is setup. if [ "${steamuser}" == "username" ]; then - fn_printfailnl "Steam login not set. Update steamuser." + fn_print_fail_nl "Steam login not set. Update steamuser." echo " * Change steamuser=\"username\" to a valid steam login." if [ -d "${scriptlogdir}" ]; then fn_scriptlog "edit ${selfname}. change steamuser=\"username\" to a valid steam login." @@ -29,7 +29,7 @@ if [ "${steamuser}" == "username" ]; then fi # Anonymous user is set if steamuser is missing if [ -z "${steamuser}" ]; then - fn_printwarnnl "Steam login not set. Using anonymous login." + fn_print_warn_nl "Steam login not set. Using anonymous login." if [ -d "${scriptlogdir}" ]; then fn_scriptlog "Steam login not set. Using anonymous login." fi @@ -47,14 +47,14 @@ if [ ! -f "${steamcmddir}/steamcmd.sh" ]; then if [ "${function_selfname}" == "command_install.sh" ]; then fn_install_steamcmd else - fn_printwarnnl "SteamCMD is missing" + fn_print_warn_nl "SteamCMD is missing" fn_scriptlog "SteamCMD is missing" sleep 1 fn_install_steamcmd fi elif [ "${function_selfname}" == "command_install.sh" ]; then - fn_printinfomation "SteamCMD is already installed..." - fn_printokeolnl + fn_print_infomation "SteamCMD is already installed..." + fn_print_ok_eol_nl fi } @@ -63,7 +63,7 @@ if [ "${function_selfname}" == "command_update.sh" ]||[ "${function_selfname}" = # Checks that steamcmd is working correctly and will prompt Steam Guard if required. "${steamcmddir}"/steamcmd.sh +login "${steamuser}" "${steampass}" +quit if [ $? -ne 0 ]; then - fn_printfailurenl "Error running SteamCMD" + fn_print_failure_nl "Error running SteamCMD" fi fi } diff --git a/functions/check_system_dir.sh b/functions/check_system_dir.sh index ecada4e09..d5d57e75b 100644 --- a/functions/check_system_dir.sh +++ b/functions/check_system_dir.sh @@ -5,7 +5,7 @@ lgsm_version="271215" if [ ! -d "${systemdir}" ]; then - fn_printfailnl "Cannot access ${systemdir}: No such directory" + fn_print_fail_nl "Cannot access ${systemdir}: No such directory" if [ -d "${scriptlogdir}" ]; then fn_scriptlog "Cannot access ${systemdir}: No such directory." fi diff --git a/functions/check_tmux.sh b/functions/check_tmux.sh index ac142ebe4..49f43dd21 100644 --- a/functions/check_tmux.sh +++ b/functions/check_tmux.sh @@ -9,7 +9,7 @@ lgsm_version="271215" if [ "$(command -v tmux)" ]||[ "$(which tmux >/dev/null 2>&1)" ]||[ -f "/usr/bin/tmux" ]||[ -f "/bin/tmux" ]; then : else - fn_printfailnl "Tmux not installed" + fn_print_fail_nl "Tmux not installed" sleep 1 fn_scriptlog "Tmux is not installed" echo " * Tmux is required to run this server." diff --git a/functions/command_backup.sh b/functions/command_backup.sh index 5f923ad07..d8d52f4bc 100644 --- a/functions/command_backup.sh +++ b/functions/command_backup.sh @@ -30,7 +30,7 @@ done tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:") if [ "${tmuxwc}" -eq 1 ]; then echo "" - fn_printwarningnl "${servicename} is currently running." + fn_print_warning_nl "${servicename} is currently running." sleep 1 while true; do read -p "Stop ${servicename} while running the backup? [y/N]" yn @@ -59,6 +59,6 @@ echo "Backup created: ${backupdir}/${backupname}.tar.gz" fn_scriptlog "Created: ${backupdir}/${backupname}.tar.gz" sleep 1 echo "" -fn_printcompletenl "Complete." +fn_print_complete_nl "Complete." fn_scriptlog "Complete" echo "" diff --git a/functions/command_console.sh b/functions/command_console.sh index 4eab4d6eb..f7f2c1323 100644 --- a/functions/command_console.sh +++ b/functions/command_console.sh @@ -15,7 +15,7 @@ echo "${gamename} Console" echo "============================" echo "" echo "Press \"CTRL+b d\" to exit console." -fn_printwarningnl "Do NOT press CTRL+c to exit." +fn_print_warning_nl "Do NOT press CTRL+c to exit." echo "" while true; do read -e -i "y" -p "Continue? [y/N]" yn @@ -25,16 +25,16 @@ while true; do * ) echo "Please answer yes or no.";; esac done -fn_printdots "Starting" +fn_print_dots "Starting" sleep 1 tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:") if [ "${tmuxwc}" -eq 1 ]; then - fn_printoknl "Starting" + fn_print_ok_nl "Starting" fn_scriptlog "accessed" sleep 1 tmux attach-session -t ${servicename} else - fn_printfailnl "Server not running" + fn_print_fail_nl "Server not running" fn_scriptlog "Failed to access: Server not running" sleep 1 while true; do diff --git a/functions/command_debug.sh b/functions/command_debug.sh index 097ddf289..7c9aca38b 100644 --- a/functions/command_debug.sh +++ b/functions/command_debug.sh @@ -31,7 +31,7 @@ fi echo "" echo -e "Use for identifying server issues only!" echo -e "Press CTRL+c to drop out of debug mode." -fn_printwarningnl "If ${servicename} is already running it will be stopped." +fn_print_warning_nl "If ${servicename} is already running it will be stopped." echo "" while true; do read -e -i "y" -p "Continue? [Y/n]" yn @@ -42,13 +42,13 @@ while true; do esac done fn_scriptlog "Starting debug" -fn_printinfonl "Stopping any running servers" +fn_print_info_nl "Stopping any running servers" fn_scriptlog "Stopping any running servers" sleep 1 command_stop.sh -fn_printdots "Starting debug" +fn_print_dots "Starting debug" sleep 1 -fn_printok "Starting debug" +fn_print_ok "Starting debug" fn_scriptlog "Started debug" sleep 1 echo -en "\n" diff --git a/functions/command_details.sh b/functions/command_details.sh index 0084f20e5..177575fe8 100644 --- a/functions/command_details.sh +++ b/functions/command_details.sh @@ -628,5 +628,5 @@ elif [ "${gamename}" == "7 Days To Die" ]; then elif [ "${gamename}" == "Teamspeak 3" ]; then fn_details_teamspeak3 else - fn_printerrornl "Unable to detect server engine." + fn_print_error_nl "Unable to detect server engine." fi diff --git a/functions/command_dev_debug.sh b/functions/command_dev_debug.sh index e2c9d9cc5..1855f5919 100644 --- a/functions/command_dev_debug.sh +++ b/functions/command_dev_debug.sh @@ -8,8 +8,8 @@ function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" if [ -f ".dev-debug" ]; then rm .dev-debug - fn_printoknl "Disabled dev-debug" + fn_print_ok_nl "Disabled dev-debug" else date > .dev-debug - fn_printoknl "Enabled dev-debug" + fn_print_ok_nl "Enabled dev-debug" fi \ No newline at end of file diff --git a/functions/command_email_test.sh b/functions/command_email_test.sh index b24ff3b01..26a0b6a42 100644 --- a/functions/command_email_test.sh +++ b/functions/command_email_test.sh @@ -17,6 +17,6 @@ if [ "${emailnotification}" = "on" ]; then actiontaken="Sent test email...hello is this thing on?" email.sh else - fn_printfailnl "Notifications not enabled" + fn_print_fail_nl "Notifications not enabled" fn_scriptlog "Notifications not enabled" fi \ No newline at end of file diff --git a/functions/command_monitor.sh b/functions/command_monitor.sh index f253abc54..e09b6236c 100644 --- a/functions/command_monitor.sh +++ b/functions/command_monitor.sh @@ -13,33 +13,33 @@ function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" fn_monitor_teamspeak3(){ check.sh logs.sh -fn_printdots "${servername}" +fn_print_dots "${servername}" fn_scriptlog "${servername}" sleep 1 if [ ! -f "${rootdir}/${lockselfname}" ]; then - fn_printinfo "Disabled: No lock file found" + fn_print_info "Disabled: No lock file found" fn_scriptlog "Disabled: No lock file found" sleep 1 echo -en "\n" echo "To enable monitor run ./${selfname} start" exit 1 fi -fn_printdots "Checking session: CHECKING" +fn_print_dots "Checking session: CHECKING" fn_scriptlog "Checking session: CHECKING" sleep 1 info_ts3status.sh if [ "${ts3status}" = "Server is running" ]; then - fn_printok "Checking session: OK" + fn_print_ok "Checking session: OK" fn_scriptlog "Checking session: OK" sleep 1 sleep 0.5 echo -en "\n" exit else - fn_printfail "Checking session: FAIL" + fn_print_fail "Checking session: FAIL" fn_scriptlog "Checking session: FAIL" sleep 1 - fn_printfail "Checking session: FAIL: ${ts3status}" + fn_print_fail "Checking session: FAIL: ${ts3status}" fn_scriptlog "Checking session: FAIL: ${ts3status}" failurereason="${ts3status}" if [ "${emailnotification}" = "on" ]; then @@ -56,11 +56,11 @@ fn_restart fn_monitor_tmux(){ check.sh info_config.sh -fn_printdots "${servername}" +fn_print_dots "${servername}" fn_scriptlog "${servername}" sleep 1 if [ ! -f "${rootdir}/${lockselfname}" ]; then - fn_printinfo "Disabled: No lock file found" + fn_print_info "Disabled: No lock file found" fn_scriptlog "Disabled: No lock file found" sleep 1 echo -en "\n" @@ -70,12 +70,12 @@ fi updatecheck=$(ps -ef|grep "${selfname} update"|grep -v grep|wc -l) if [ "${updatecheck}" = "0" ]||[ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "Unreal Tournament 2004" ]; then - fn_printdots "Checking session: CHECKING" + fn_print_dots "Checking session: CHECKING" fn_scriptlog "Checking session: CHECKING" sleep 1 tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:") if [ "${tmuxwc}" -eq 1 ]; then - fn_printok "Checking session: OK" + fn_print_ok "Checking session: OK" fn_scriptlog "Checking session: OK" sleep 1 echo -en "\n" @@ -85,7 +85,7 @@ if [ "${updatecheck}" = "0" ]||[ "${gamename}" == "Unreal Tournament 99" ]||[ "$ fi exit $? else - fn_printfail "Checking session: FAIL" + fn_print_fail "Checking session: FAIL" fn_scriptlog "Checking session: FAIL" sleep 1 echo -en "\n" @@ -99,10 +99,10 @@ if [ "${updatecheck}" = "0" ]||[ "${gamename}" == "Unreal Tournament 99" ]||[ "$ command_start.sh fi else - fn_printinfonl "SteamCMD is currently checking for updates" + fn_print_info_nl "SteamCMD is currently checking for updates" fn_scriptlog "SteamCMD is currently checking for updates" sleep 1 - fn_printinfonl "When update is complete ${servicename} will start" + fn_print_info_nl "When update is complete ${servicename} will start" fn_scriptlog "When update is complete ${servicename} will start" sleep 1 fi diff --git a/functions/command_start.sh b/functions/command_start.sh index 309a8078f..fd30a17bb 100644 --- a/functions/command_start.sh +++ b/functions/command_start.sh @@ -21,7 +21,7 @@ if [ "${ts3status}" != "Server is running" ]; then fi if [ ! -e "${servercfgfullpath}" ]; then - fn_printwarn "${servercfgfullpath} is missing" + fn_print_warn "${servercfgfullpath} is missing" fn_scriptlog "${servercfgfullpath} is missing" sleep 2 echo -en "\n" @@ -39,12 +39,12 @@ fi logs.sh -fn_printdots "${servername}" +fn_print_dots "${servername}" fn_scriptlog "${servername}" sleep 1 if [ "${ts3status}" == "Server is running" ]; then - fn_printinfo "${servername} is already running" + fn_print_info "${servername} is already running" fn_scriptlog "${servername} is already running" sleep 1 echo -en "\n" @@ -63,12 +63,12 @@ fi sleep 1 info_ts3status.sh if [ "${ts3status}" = "Server seems to have died" ]||[ "${ts3status}" = "No server running (ts3server.pid is missing)" ]; then - fn_printfailnl "Unable to start ${servername}" + fn_print_fail_nl "Unable to start ${servername}" fn_scriptlog "Unable to start ${servername}" echo -e " Check log files: ${rootdir}/log" exit 1 else - fn_printok "${servername}" + fn_print_ok "${servername}" fn_scriptlog "Started ${servername}" fi sleep 0.5 @@ -90,7 +90,7 @@ if [ "${tmuxwc}" -eq 0 ]; then fi fi -fn_printdots "${servername}" +fn_print_dots "${servername}" fn_scriptlog "${servername}" sleep 1 @@ -104,7 +104,7 @@ if [ "${tmuxwc}" -eq 0 ]; then fi if [ "${tmuxwc}" -eq 1 ]; then - fn_printinfo "${servername} is already running" + fn_print_info "${servername} is already running" fn_scriptlog "${servername} is already running" sleep 1 echo -en "\n" @@ -132,11 +132,11 @@ sleep 1 tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:") # If the server fails to start if [ "${tmuxwc}" -eq 0 ]; then - fn_printfailnl "Unable to start ${servername}" + fn_print_fail_nl "Unable to start ${servername}" fn_scriptlog "Unable to start ${servername}" sleep 1 if [ -s "${scriptlogdir}/.${servicename}-tmux-error.tmp" ]; then - fn_printfailnl "Unable to start ${servername}: Tmux error:" + fn_print_fail_nl "Unable to start ${servername}: Tmux error:" fn_scriptlog "Tmux error" sleep 1 echo -en "\n" @@ -180,7 +180,7 @@ if [ "${tmuxwc}" -eq 0 ]; then fi exit 1 else - fn_printok "${servername}" + fn_print_ok "${servername}" fn_scriptlog "Started ${servername}" fi rm "${scriptlogdir}/.${servicename}-tmux-error.tmp" diff --git a/functions/command_stop.sh b/functions/command_stop.sh index 98d21c9a5..d5d589beb 100644 --- a/functions/command_stop.sh +++ b/functions/command_stop.sh @@ -31,16 +31,16 @@ sdtd_telnet(){ fn_stop_teamspeak3(){ check.sh -fn_printdots "${servername}" +fn_print_dots "${servername}" fn_scriptlog "${servername}" sleep 1 info_ts3status.sh if [ "${ts3status}" = "No server running (ts3server.pid is missing)" ]; then - fn_printfail "${servername} is already stopped" + fn_print_fail "${servername} is already stopped" fn_scriptlog "${servername} is already stopped" else ${filesdir}/ts3server_startscript.sh stop > /dev/null 2>&1 - fn_printok "${servername}" + fn_print_ok "${servername}" fn_scriptlog "Stopped ${servername}" fi # Remove lock file @@ -52,14 +52,14 @@ echo -en "\n" fn_stop_tmux(){ check.sh info_config.sh -fn_printdots "${servername}" +fn_print_dots "${servername}" fn_scriptlog "${servername}" sleep 1 if [ "${gamename}" == "7 Days To Die" ] ; then # if game is 7 Days To Die, we need special, graceful shutdown via telnet connection. # Set below variable to be called for expect to operate correctly.. - fn_printdots "Attempting graceful shutdown via telnet" + fn_print_dots "Attempting graceful shutdown via telnet" fn_scriptlog "Attempting graceful shutdown via telnet" sleep 1 telnetip=127.0.0.1 @@ -69,11 +69,11 @@ if [ "${gamename}" == "7 Days To Die" ] ; then refused=$(echo -en "\n ${sdtdshutdown}"| grep "Timeout or EOF") if [ -n "${refused}" ]; then telnetip=${ip} - fn_printwarn "Attempting graceful shutdown via telnet: localhost failed" + fn_print_warn "Attempting graceful shutdown via telnet: localhost failed" fn_scriptlog "Warning! Attempting graceful shutdown failed using localhost" sleep 5 echo -en "\n" - fn_printdots "Attempting graceful shutdown via telnet: using ${telnetip}" + fn_print_dots "Attempting graceful shutdown via telnet: using ${telnetip}" fn_scriptlog "Attempting graceful shutdown via telnet using ${telnetip}" sdtd_telnet sleep 1 @@ -82,14 +82,14 @@ if [ "${gamename}" == "7 Days To Die" ] ; then refused=$(echo -en "\n ${sdtdshutdown}"| grep "Timeout or EOF") completed=$(echo -en "\n ${sdtdshutdown}"| grep "Completed.") if [ -n "${refused}" ]; then - fn_printfail "Attempting graceful shutdown via telnet" + fn_print_fail "Attempting graceful shutdown via telnet" fn_scriptlog "Attempting graceful shutdown failed" fn_scriptlog "${refused}" elif [ -n "${completed}" ]; then - fn_printok "Attempting graceful shutdown via telnet" + fn_print_ok "Attempting graceful shutdown via telnet" fn_scriptlog "Attempting graceful shutdown succeeded" else - fn_printfail "Attempting graceful shutdown via telnet: Unknown error" + fn_print_fail "Attempting graceful shutdown via telnet: Unknown error" fn_scriptlog "Attempting graceful shutdown failed" fn_scriptlog "Unknown error" fi @@ -99,29 +99,29 @@ if [ "${gamename}" == "7 Days To Die" ] ; then echo -en "\n ${sdtdshutdown}" echo -en "\n\n" sleep 1 - fn_printdots "${servername}" + fn_print_dots "${servername}" fn_scriptlog "${servername}" sleep 5 pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:") if [ "${pid}" == "0" ]; then - fn_printok "${servername} is already stopped using graceful shutdown" + fn_print_ok "${servername} is already stopped using graceful shutdown" fn_scriptlog "${servername} is already stopped using graceful shutdown" else tmux kill-session -t "${servicename}" - fn_printok "${servername}" + fn_print_ok "${servername}" fn_scriptlog "Stopped ${servername}" fi else pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:") if [ "${pid}" == "0" ]; then - fn_printfail "${servername} is already stopped" + fn_print_fail "${servername} is already stopped" fn_scriptlog "${servername} is already stopped" else if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then sleep 1 - fn_printdots "Attempting graceful shutdown" + fn_print_dots "Attempting graceful shutdown" fn_scriptlog "Attempting graceful shutdown" tmux send -t "${servicename}" quit ENTER > /dev/null 2>&1 counter=0 @@ -130,19 +130,19 @@ else sleep 1 let counter=counter+1 if [ "${counter}" -gt "1" ]; then - fn_printdots "Attempting graceful shutdown: ${counter}" + fn_print_dots "Attempting graceful shutdown: ${counter}" fi done pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:") if [ "${pid}" == "0" ]; then - fn_printok "Attempting graceful shutdown" + fn_print_ok "Attempting graceful shutdown" else - fn_printfail "Attempting graceful shutdown" + fn_print_fail "Attempting graceful shutdown" fi fi tmux kill-session -t "${servicename}" > /dev/null 2>&1 - fn_printok "${servername}" + fn_print_ok "${servername}" fn_scriptlog "Stopped ${servername}" fi fi diff --git a/functions/command_ts3_server_pass.sh b/functions/command_ts3_server_pass.sh index 3cd0f0b1f..eba76523a 100644 --- a/functions/command_ts3_server_pass.sh +++ b/functions/command_ts3_server_pass.sh @@ -17,8 +17,8 @@ echo "${gamename} ServerAdmin Password Change" echo "============================" echo "" echo "Press \"CTRL+b d\" to exit console." -fn_printinfomationnl "You are about to change the ${gamename} ServerAdmin password." -fn_printwarningnl "${gamename} will restart during this process." +fn_print_infomation_nl "You are about to change the ${gamename} ServerAdmin password." +fn_print_warning_nl "${gamename} will restart during this process." echo "" while true; do read -e -i "y" -p "Continue? [y/N]" yn @@ -34,18 +34,18 @@ read -p "Enter new password : " newpassword fn_serveradmin_password_set(){ -fn_printinfonl "Applying new password" +fn_print_info_nl "Applying new password" fn_scriptlog "Applying new password" sleep 1 # Stop any running server command_stop.sh # Start server in "new password mode" ts3serverpass="1" -fn_printinfonl "Starting server with new password" +fn_print_info_nl "Starting server with new password" command_start.sh # Stop server in "new password mode" command_stop.sh -fn_printoknl "Password applied" +fn_print_ok_nl "Password applied" fn_scriptlog "New ServerAdmin password applied" sleep 1 } diff --git a/functions/command_update_functions.sh b/functions/command_update_functions.sh index 3c530e4a0..9c0ac4b90 100644 --- a/functions/command_update_functions.sh +++ b/functions/command_update_functions.sh @@ -8,7 +8,7 @@ lgsm_version="270216" function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" check.sh -fn_printdots "Updating functions" +fn_print_dots "Updating functions" fn_scriptlog "Updating functions" sleep 1 echo -ne "\n" @@ -23,15 +23,15 @@ if [ -n "${functionsdir}" ]; then rm -rfv "${functionsdir}/"* exitcode=$? else - fn_printfail "Updating functions" + fn_print_fail "Updating functions" fn_scriptlog "Failure! Updating functions" fi if [ "${exitcode}" == "0" ]; then - fn_printok "Updating functions" + fn_print_ok "Updating functions" fn_scriptlog "Success! Updating functions" else - fn_printfail "Updating functions" + fn_print_fail "Updating functions" fn_scriptlog "Failure! Updating functions" fi echo -ne "\n" \ No newline at end of file diff --git a/functions/command_validate.sh b/functions/command_validate.sh index 40e23c01e..59c03b6ff 100644 --- a/functions/command_validate.sh +++ b/functions/command_validate.sh @@ -10,15 +10,15 @@ local modulename="Validate" function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" fn_validation(){ -fn_printwarn "Validating may overwrite some customised files." +fn_print_warn "Validating may overwrite some customised files." sleep 1 echo -en "\n" echo -en "https://developer.valvesoftware.com/wiki/SteamCMD#Validate" sleep 5 echo -en "\n" -fn_printdots "Checking server files" +fn_print_dots "Checking server files" sleep 1 -fn_printok "Checking server files" +fn_print_ok "Checking server files" fn_scriptlog "Checking server files" sleep 1 diff --git a/functions/core_dl.sh b/functions/core_dl.sh index 8275d5770..cf3a2d777 100644 --- a/functions/core_dl.sh +++ b/functions/core_dl.sh @@ -25,7 +25,7 @@ if [ -n "${md5}" ]||[ "${md5}" == "nomd5" ]; then sleep 1 local md5sumcmd=$(md5sum "${filedir}/${filename}"|awk '{print $1;}') if [ "${md5sumcmd}" != "${md5}" ]; then - fn_printfaileolnl + fn_print_fail_eol_nl echo "${filename} returned MD5 checksum: ${md5sumcmd}" echo "expected MD5 checksum: ${md5}" fn_scriptlog "verifying ${filename} with MD5: FAIL" @@ -33,7 +33,7 @@ if [ -n "${md5}" ]||[ "${md5}" == "nomd5" ]; then fn_scriptlog "expected MD5 checksum: ${md5}" exit 1 else - fn_printokeolnl + fn_print_ok_eol_nl fn_scriptlog "verifying ${filename} with MD5: OK" fn_scriptlog "${filename} returned MD5 checksum: ${md5sumcmd}" fn_scriptlog "expected MD5 checksum: ${md5}" @@ -61,12 +61,12 @@ elif [ "${mime}" == "application/x-bzip2" ]; then fi local exitcode=$? if [ ${exitcode} -ne 0 ]; then - fn_printfaileolnl + fn_print_fail_eol_nl fn_scriptlog "extracting download: FAIL" echo "${tarcmd}" | tee -a "${scriptlog}" exit ${exitcode} else - fn_printokeolnl + fn_print_ok_eol_nl fi } @@ -74,12 +74,12 @@ fi fn_fetch_trap() { echo "" echo -ne "downloading ${filename}: " - fn_printcanceledeol + fn_print_canceled_eol fn_scriptlog "downloading ${filename}: CANCELED" sleep 1 rm -f "${filedir}/${filename}" | tee -a "${scriptlog}" echo -ne "downloading ${filename}: " - fn_printremovedeol + fn_print_removed_eol fn_scriptlog "downloading ${filename}: REMOVED" exit } @@ -123,7 +123,7 @@ if [ ! -f "${filedir}/${filename}" ]; then fi local exitcode=$? if [ ${exitcode} -ne 0 ]; then - fn_printfaileolnl + fn_print_fail_eol_nl if [ -f "${scriptlog}" ]; then fn_scriptlog "downloading ${filename}: FAIL" fi @@ -131,7 +131,7 @@ if [ ! -f "${filedir}/${filename}" ]; then echo -e "${fileurl}\n" | tee -a "${scriptlog}" exit ${exitcode} else - fn_printokeolnl + fn_print_ok_eol_nl if [ -f "${scriptlog}" ]; then fn_scriptlog "downloading ${filename}: OK" fi @@ -139,7 +139,7 @@ if [ ! -f "${filedir}/${filename}" ]; then # remove trap trap - INT else - fn_printfaileolnl + fn_print_fail_eol_nl echo "Curl is not installed!" echo -e "" exit 1 diff --git a/functions/core_messages.sh b/functions/core_messages.sh index 56251e6db..6581d2f17 100644 --- a/functions/core_messages.sh +++ b/functions/core_messages.sh @@ -6,6 +6,9 @@ lgsm_version="380216" # Description: Defines on-screen messages such as [ OK ] and how script logs look. +# nl: new line: message is following by a new line +# eol: end of line: message is placed at the end of the current line + # Date and servicename for log files. fn_scriptlog(){ if [ -n "${modulename}" ]; then @@ -16,7 +19,7 @@ fn_scriptlog(){ } # [ FAIL ] -fn_printfail(){ +fn_print_fail(){ if [ -n "${modulename}" ]; then echo -en "\r\033[K[\e[0;31m FAIL \e[0m] ${modulename} ${servicename}: $@" else @@ -24,7 +27,7 @@ fn_printfail(){ fi } -fn_printfailnl(){ +fn_print_fail_nl(){ if [ -n "${modulename}" ]; then echo -e "\r\033[K[\e[0;31m FAIL \e[0m] ${modulename} ${servicename}: $@" else @@ -33,7 +36,7 @@ fn_printfailnl(){ } # [ OK ] -fn_printok(){ +fn_print_ok(){ if [ -n "${modulename}" ]; then echo -en "\r\033[K[\e[0;32m OK \e[0m] ${modulename} ${servicename}: $@" else @@ -41,7 +44,7 @@ fn_printok(){ fi } -fn_printoknl(){ +fn_print_ok_nl(){ if [ -n "${modulename}" ]; then echo -e "\r\033[K[\e[0;32m OK \e[0m] ${modulename} ${servicename}: $@" else @@ -50,7 +53,7 @@ fn_printoknl(){ } # [ INFO ] -fn_printinfo(){ +fn_print_info(){ if [ -n "${modulename}" ]; then echo -en "\r\033[K[\e[0;36m INFO \e[0m] ${modulename} ${servicename}: $@" else @@ -58,7 +61,7 @@ fn_printinfo(){ fi } -fn_printinfonl(){ +fn_print_info_nl(){ if [ -n "${modulename}" ]; then echo -e "\r\033[K[\e[0;36m INFO \e[0m] ${modulename} ${servicename}: $@" else @@ -67,7 +70,7 @@ fn_printinfonl(){ } # [ WARN ] -fn_printwarn(){ +fn_print_warn(){ if [ -n "${modulename}" ]; then echo -en "\r\033[K[\e[1;33m WARN \e[0m] ${modulename} ${servicename}: $@" else @@ -75,7 +78,7 @@ fn_printwarn(){ fi } -fn_printwarnnl(){ +fn_print_warn_nl(){ if [ -n "${modulename}" ]; then echo -e "\r\033[K[\e[1;33m WARN \e[0m] ${modulename} ${servicename}: $@" else @@ -84,7 +87,7 @@ fn_printwarnnl(){ } # [ .... ] -fn_printdots(){ +fn_print_dots(){ if [ -n "${modulename}" ]; then echo -en "\r\033[K[ .... ] ${modulename} ${servicename}: $@" else @@ -93,91 +96,91 @@ fn_printdots(){ } # Complete! -fn_printcomplete(){ +fn_print_complete(){ echo -en "\e[0;32mComplete!\e[0m $@" } -fn_printcompletenl(){ +fn_print_complete_nl(){ echo -e "\e[0;32mComplete!\e[0m $@" } # Warning! -fn_printwarning(){ +fn_print_warning(){ echo -en "\e[0;33mWarning!\e[0m $@" } -fn_printwarningnl(){ +fn_print_warning_nl(){ echo -e "\e[0;33mWarning!\e[0m $@" } # Failure! -fn_printfailure(){ +fn_print_failure(){ echo -en "\e[0;31mFailure!\e[0m $@" } -fn_printfailurenl(){ +fn_print_failure_nl(){ echo -e "\e[0;31mFailure!\e[0m $@" } # Error! -fn_printerror(){ +fn_print_error(){ echo -en "\e[0;31mError!\e[0m $@" } -fn_printerrornl(){ +fn_print_error_nl(){ echo -e "\e[0;31mError!\e[0m $@" } # Info! -fn_printinfomation(){ - echo -en "\e[0;36mInfo!\e[0m $@" +fn_print_infomation(){ + echo -en "\e[0;36mInfomation!\e[0m $@" } -fn_printinfomationnl(){ - echo -e "\e[0;36mInfo!\e[0m $@" +fn_print_infomation_nl(){ + echo -e "\e[0;36mInfomation!\e[0m $@" } # FAIL for end of line -fn_printokeol(){ +fn_print_ok_eol(){ echo -en "\e[0;32mOK\e[0m" } -fn_printokeolnl(){ +fn_print_ok_eol_nl(){ echo -e "\e[0;32mOK\e[0m" } # FAIL for end of line -fn_printfaileol(){ +fn_print_fail_eol(){ echo -en "\e[0;31mFAIL\e[0m\n" } -fn_printfaileolnl(){ +fn_print_fail_eol_nl(){ echo -e "\e[0;31mFAIL\e[0m\n" } # QUERYING for end of line -fn_printqueryingeol(){ - echo -en "\e[0;31mQUERYING\e[0m\n" +fn_print_querying_eol(){ + echo -en "\e[0;36mQUERYING\e[0m\n" } -fn_printqueryingeolnl(){ - echo -e "\e[0;31mQUERYING\e[0m\n" +fn_print_querying_eol_nl(){ + echo -e "\e[0;36mQUERYING\e[0m\n" } # CANCELED for end of line -fn_printcanceledeol(){ - echo -en "\e[0;31mCANCELED\e[0m\n" +fn_print_canceled_eol(){ + echo -en "\e[0;33mCANCELED\e[0m\n" } -fn_printcanceledeolnl(){ - echo -e "\e[0;31mCANCELED\e[0m\n" +fn_print_canceled_eol_nl(){ + echo -e "\e[0;33mCANCELED\e[0m\n" } # REMOVED for end of line -fn_printremovedeol(){ +fn_print_removed_eol(){ echo -en "\e[0;31mREMOVED\e[0m\n" } -fn_printremovedeolnl(){ +fn_print_removed_eol_nl(){ echo -e "\e[0;31mREMOVED\e[0m\n" } \ No newline at end of file diff --git a/functions/email.sh b/functions/email.sh index 93d259d80..66d5acba7 100644 --- a/functions/email.sh +++ b/functions/email.sh @@ -7,7 +7,7 @@ lgsm_version="020216" # Description: Sends email notification if monitor picks up a failure. local modulename="Email" -fn_printdots "Sending notification to ${email}" +fn_print_dots "Sending notification to ${email}" info_distro.sh info_config.sh check_ip.sh @@ -64,7 +64,7 @@ if [ ! -z "${gamelogdir}" ]; then tail "${gamelogdir}"/* | grep -v "==>" | sed '/^$/d' | tail -25 >> "${emaillog}" fi mail -s "${subject}" ${email} < "${emaillog}" -fn_printok "Sending notification to ${email}" +fn_print_ok "Sending notification to ${email}" fn_scriptlog "Sent notification to ${email}" sleep 1 echo -en "\n" diff --git a/functions/fix_arma3.sh b/functions/fix_arma3.sh index b0a1317de..b076fe065 100644 --- a/functions/fix_arma3.sh +++ b/functions/fix_arma3.sh @@ -7,19 +7,19 @@ lgsm_version="301215" # Fixes line 63: 20150 Segmentation fault (core dumped) #488 fn_msg_start(){ - fn_printdots "Applying ${fixname} fix: ${gamename}" + fn_print_dots "Applying ${fixname} fix: ${gamename}" sleep 1 - fn_printinfo "Applying ${fixname} fix: ${gamename}" + fn_print_info "Applying ${fixname} fix: ${gamename}" fn_scriptlog "Applying ${fixname} fix: ${gamename}" sleep 1 } fn_msg_end(){ if [ $? -ne 0 ]; then - fn_printfailnl "Applying ${fixname} fix: ${gamename}" + fn_print_fail_nl "Applying ${fixname} fix: ${gamename}" fn_scriptlog "Failure! Applying ${fixname} fix: ${gamename}" else - fn_printoknl "Applying ${fixname} fix: ${gamename}" + fn_print_ok_nl "Applying ${fixname} fix: ${gamename}" fn_scriptlog "Complete! Applying ${fixname} fix: ${gamename}" fi } diff --git a/functions/fix_csgo.sh b/functions/fix_csgo.sh index 4227d36eb..33fd7c169 100644 --- a/functions/fix_csgo.sh +++ b/functions/fix_csgo.sh @@ -7,19 +7,19 @@ lgsm_version="301215" # Description: Resolves various issues with csgo. fn_msg_start(){ - fn_printdots "Applying ${fixname} fix: ${gamename}" + fn_print_dots "Applying ${fixname} fix: ${gamename}" sleep 1 - fn_printinfo "Applying ${fixname} fix: ${gamename}" + fn_print_info "Applying ${fixname} fix: ${gamename}" fn_scriptlog "Applying ${fixname} fix: ${gamename}" sleep 1 } fn_msg_end(){ if [ $? -ne 0 ]; then - fn_printfailnl "Applying ${fixname} fix: ${gamename}" + fn_print_fail_nl "Applying ${fixname} fix: ${gamename}" fn_scriptlog "Failure! Applying ${fixname} fix: ${gamename}" else - fn_printoknl "Applying ${fixname} fix: ${gamename}" + fn_print_ok_nl "Applying ${fixname} fix: ${gamename}" fn_scriptlog "Complete! Applying ${fixname} fix: ${gamename}" fi } diff --git a/functions/fix_dst.sh b/functions/fix_dst.sh index 7a0028504..b860f6d09 100644 --- a/functions/fix_dst.sh +++ b/functions/fix_dst.sh @@ -7,19 +7,19 @@ lgsm_version="020116" # Fixes line 63: 20150 Segmentation fault (core dumped) #488 fn_msg_start(){ - fn_printdots "Applying ${fixname} fix: ${gamename}" + fn_print_dots "Applying ${fixname} fix: ${gamename}" sleep 1 - fn_printinfo "Applying ${fixname} fix: ${gamename}" + fn_print_info "Applying ${fixname} fix: ${gamename}" fn_scriptlog "Applying ${fixname} fix: ${gamename}" sleep 1 } fn_msg_end(){ if [ $? -ne 0 ]; then - fn_printfailnl "Applying ${fixname} fix: ${gamename}" + fn_print_fail_nl "Applying ${fixname} fix: ${gamename}" fn_scriptlog "Failure! Applying ${fixname} fix: ${gamename}" else - fn_printoknl "Applying ${fixname} fix: ${gamename}" + fn_print_ok_nl "Applying ${fixname} fix: ${gamename}" fn_scriptlog "Complete! Applying ${fixname} fix: ${gamename}" fi } diff --git a/functions/fix_glibc.sh b/functions/fix_glibc.sh index 83422f12b..c46a1b5a0 100644 --- a/functions/fix_glibc.sh +++ b/functions/fix_glibc.sh @@ -9,7 +9,7 @@ echo "" echo "GLIBC Fix required" echo "============================" sleep 1 -fn_printwarningnl "${gamename} requires GLIBC_${glibcversion} or above" +fn_print_warning_nl "${gamename} requires GLIBC_${glibcversion} or above" sleep 1 echo "" echo -e "Currently installed:\e[0;31m GLIBC_$(ldd --version |grep ldd|awk '{print $NF}')\e[0;39m" @@ -34,7 +34,7 @@ echo -en "\n" # if ldd command not detected if [ -z $(command -v ldd) ]; then echo "" - fn_printfailurenl "GLIBC is not detected" + fn_print_failure_nl "GLIBC is not detected" sleep 1 echo "Install GLIBC and retry installation." sleep 1 diff --git a/functions/fix_steamcmd.sh b/functions/fix_steamcmd.sh index 862b4736f..a05f783c4 100644 --- a/functions/fix_steamcmd.sh +++ b/functions/fix_steamcmd.sh @@ -7,19 +7,19 @@ lgsm_version="010116" # Description: fixes various issues related to steamCMD. fn_msg_start(){ - fn_printdots "Applying ${fixname} fix: ${gamename}" + fn_print_dots "Applying ${fixname} fix: ${gamename}" sleep 1 - fn_printinfo "Applying ${fixname} fix: ${gamename}" + fn_print_info "Applying ${fixname} fix: ${gamename}" fn_scriptlog "Applying ${fixname} fix: ${gamename}" sleep 1 } fn_msg_end(){ if [ $? -ne 0 ]; then - fn_printfailnl "Applying ${fixname} fix: ${gamename}" + fn_print_fail_nl "Applying ${fixname} fix: ${gamename}" fn_scriptlog "Failure! Applying ${fixname} fix: ${gamename}" else - fn_printoknl "Applying ${fixname} fix: ${gamename}" + fn_print_ok_nl "Applying ${fixname} fix: ${gamename}" fn_scriptlog "Complete! Applying ${fixname} fix: ${gamename}" fi } diff --git a/functions/fn_update_functions b/functions/fn_update_functions index 414649f6a..5fbb28975 100644 --- a/functions/fn_update_functions +++ b/functions/fn_update_functions @@ -6,17 +6,17 @@ lgsm_version="230116" # Description: LEGACY FUNCTION Deletes the functions dir to allow re-downloading of functions from GitHub. -fn_printdots "Updating functions" +fn_print_dots "Updating functions" fn_scriptlog "Updating functions" sleep 1 echo -ne "\n" rm -rfv "${rootdir}/functions/"* exitcode=$? if [ "${exitcode}" == "0" ]; then - fn_printok "Updating functions" + fn_print_ok "Updating functions" fn_scriptlog "Success! Updating functions" else - fn_printfail "Updating functions" + fn_print_fail "Updating functions" fn_scriptlog "Failure! Updating functions" fi echo -ne "\n" \ No newline at end of file diff --git a/functions/install_server_dir.sh b/functions/install_server_dir.sh index 1a4f54b77..ab73ecfd2 100644 --- a/functions/install_server_dir.sh +++ b/functions/install_server_dir.sh @@ -14,7 +14,7 @@ echo "" pwd echo "" if [ -d "${filesdir}" ]; then - fn_printwarningnl "A server is already installed here." + fn_print_warning_nl "A server is already installed here." fi if [ -z "${autoinstall}" ]; then while true; do diff --git a/functions/install_server_files.sh b/functions/install_server_files.sh index f345c09f1..d6655689b 100644 --- a/functions/install_server_files.sh +++ b/functions/install_server_files.sh @@ -29,7 +29,7 @@ while [ "${counter}" == "0" ]||[ "${exitcode}" != "0" ]; do # Attempt 11: Failure if [ "${counter}" -ge "2" ]; then - fn_printwarningnl "SteamCMD did not complete the download, retrying: Attempt ${counter}" + fn_print_warning_nl "SteamCMD did not complete the download, retrying: Attempt ${counter}" fn_scriptlog "SteamCMD did not complete the download, retrying: Attempt ${counter}" fi @@ -65,7 +65,7 @@ while [ "${counter}" == "0" ]||[ "${exitcode}" != "0" ]; do fi fi elif [ "${counter}" -ge "11" ]; then - fn_printfailurenl "SteamCMD did not complete the download, too many retrys" + fn_print_failure_nl "SteamCMD did not complete the download, too many retrys" fn_scriptlog "SteamCMD did not complete the download, too many retrys" break fi @@ -74,7 +74,7 @@ done # Goldsource servers commonly fail to download all the server files required. # Validating a few of times may reduce the chance of this issue. if [ "${engine}" == "goldsource" ]; then - fn_printinfomationnl "Goldsource servers commonly fail to download all the server files required. Validating a few of times may reduce the chance of this issue." + fn_print_infomation_nl "Goldsource servers commonly fail to download all the server files required. Validating a few of times may reduce the chance of this issue." counter="0" while [ "${counter}" -le "4" ]; do counter=$((counter+1)) diff --git a/functions/install_ts3.sh b/functions/install_ts3.sh index 3a2acc224..5cf2f0f85 100644 --- a/functions/install_ts3.sh +++ b/functions/install_ts3.sh @@ -13,7 +13,7 @@ if [ "${arch}" == "x86_64" ]; then elif [ "${arch}" == "i386" ]||[ "${arch}" == "i686" ]; then ts3arch="x86" else - fn_printfailure "${arch} is an unsupported architecture" + fn_print_failure "${arch} is an unsupported architecture" exit 1 fi @@ -43,9 +43,9 @@ rm -f ".ts3_version_numbers.tmp" # Checks availablebuild info is available if [ -z "${availablebuild}" ]; then - fn_printfail "Checking for update: teamspeak.com" + fn_print_fail "Checking for update: teamspeak.com" sleep 1 - fn_printfail "Checking for update: teamspeak.com: Not returning version info" + fn_print_fail "Checking for update: teamspeak.com: Not returning version info" sleep 2 exit 1 fi diff --git a/functions/install_ts3db.sh b/functions/install_ts3db.sh index 90f5b0329..61e2db7d4 100644 --- a/functions/install_ts3db.sh +++ b/functions/install_ts3db.sh @@ -55,7 +55,7 @@ if [ -z "${autoinstall}" ]; then esac done else -fn_printwarningnl "./${selfname} auto-install is uses sqlite. For MariaDB/MySQL use ./${selfname} install" +fn_print_warning_nl "./${selfname} auto-install is uses sqlite. For MariaDB/MySQL use ./${selfname} install" fi ## Get privilege key diff --git a/functions/logs.sh b/functions/logs.sh index 54c9a9836..79d4de462 100644 --- a/functions/logs.sh +++ b/functions/logs.sh @@ -18,7 +18,7 @@ fi # Log manager will start the cleanup if it finds logs older than "${logdays}" if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; then - fn_printdots "Starting" + fn_print_dots "Starting" # Set addon logs directories sourcemodlogdir="${systemdir}/addons/sourcemod/logs" ulxlogdir="${systemdir}/data/ulx_logs" @@ -27,11 +27,11 @@ 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_printok "Starting" + fn_print_ok "Starting" fn_scriptlog "Starting" sleep 1 echo -en "\n" - fn_printinfo "Removing logs older than "${logdays}" days" + fn_print_info "Removing logs older than "${logdays}" days" fn_scriptlog "Removing logs older than "${logdays}" days" sleep 1 echo -en "\n" @@ -90,7 +90,7 @@ 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_printok "Removed ${count} log files" + fn_print_ok "Removed ${count} log files" fn_scriptlog "Removed ${count} log files" sleep 1 echo -en "\n" diff --git a/functions/monitor_gsquery.sh b/functions/monitor_gsquery.sh index 5fa63b32e..7a57aa694 100644 --- a/functions/monitor_gsquery.sh +++ b/functions/monitor_gsquery.sh @@ -27,11 +27,11 @@ if [ -z "${queryport}" ]; then fi -fn_printinfo "Querying port: gsquery.py enabled" +fn_print_info "Querying port: gsquery.py enabled" fn_scriptlog "gsquery.py enabled" sleep 1 -fn_printdots "Querying port: ${ip}:${port}: 0/1 : " -fn_printqueryingeol +fn_print_dots "Querying port: ${ip}:${port}: 0/1 : " +fn_print_querying_eol fn_scriptlog "Querying port: ${ip}:${port}: 1 : QUERYING" sleep 1 @@ -47,8 +47,8 @@ for i in {1..4}; do if [ "${exitcode}" == "0" ]; then # Server OK - fn_printok "Querying port: ${ip}:${port}: " - fn_printokeol + fn_print_ok "Querying port: ${ip}:${port}: " + fn_print_ok_eol fn_scriptlog "Querying port: ${ip}:${port}: OK" sleep 1 exit @@ -59,13 +59,13 @@ for i in {1..4}; do seconds=0 # Seconds counter while [ true ]; do - fn_printfail "Querying port: ${ip}:${port}: ${totalseconds}/${queryattempt} : \e[0;31m${gsquerycmd}\e[0m" + fn_print_fail "Querying port: ${ip}:${port}: ${totalseconds}/${queryattempt} : \e[0;31m${gsquerycmd}\e[0m" seconds=$((seconds + 1)) totalseconds=$((totalseconds + 1)) sleep 1 if [ "${seconds}" == "15" ]; then - fn_printdots "Querying port: ${ip}:${port}: ${totalseconds}/${queryattempt} : " - fn_printqueryingeol + fn_print_dots "Querying port: ${ip}:${port}: ${totalseconds}/${queryattempt} : " + fn_print_querying_eol fn_scriptlog "Querying port: ${ip}:${port}: ${queryattempt} : QUERYING" sleep 1 break @@ -75,8 +75,8 @@ for i in {1..4}; do if [ "${queryattempt}" == "4" ]; then # Server failed query 4 times confirmed failure - fn_printfail "Querying port: ${ip}:${port}: " - fn_printfaileol + fn_print_fail "Querying port: ${ip}:${port}: " + fn_print_fail_eol fn_scriptlog "Querying port: ${ip}:${port}: ${gsquerycmd}" fn_scriptlog "Querying port: ${ip}:${port}: FAIL" sleep 1 diff --git a/functions/update_check.sh b/functions/update_check.sh index 773c88b25..4342e7237 100644 --- a/functions/update_check.sh +++ b/functions/update_check.sh @@ -22,10 +22,10 @@ fn_appmanifestinfo # This is an error is corrected below if required. if [ "${appmanifestfilewc}" -ge "2" ]; then sleep 1 - fn_printwarn "Multiple appmanifest_${appid}.acf files found" + fn_print_warn "Multiple appmanifest_${appid}.acf files found" fn_scriptlog "Warning! Multiple appmanifest_${appid}.acf files found" sleep 2 - fn_printdots "Removing x${appmanifestfilewc} appmanifest_${appid}.acf files" + fn_print_dots "Removing x${appmanifestfilewc} appmanifest_${appid}.acf files" sleep 1 for appfile in ${appmanifestfile}; do rm "${appfile}" @@ -33,7 +33,7 @@ if [ "${appmanifestfilewc}" -ge "2" ]; then appmanifestfilewc1="${appmanifestfilewc}" fn_appmanifestinfo if [ "${appmanifestfilewc}" -ge "2" ]; then - fn_printfail "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files" + fn_print_fail "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files" fn_scriptlog "Failure! Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files" sleep 1 echo "" @@ -44,10 +44,10 @@ if [ "${appmanifestfilewc}" -ge "2" ]; then exit 1 else sleep 1 - fn_printok "Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files" + fn_print_ok "Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files" fn_scriptlog "Success! Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files" sleep 1 - fn_printinfonl "Forcing update to correct issue" + fn_print_info_nl "Forcing update to correct issue" fn_scriptlog "Forcing update to correct issue" sleep 1 update_dl.sh @@ -55,15 +55,15 @@ if [ "${appmanifestfilewc}" -ge "2" ]; then fi elif [ "${appmanifestfilewc}" -eq "0" ]; then if [ "${forceupdate}" == "1" ]; then - fn_printfail "Still no appmanifest_${appid}.acf found: Unable to update" + fn_print_fail "Still no appmanifest_${appid}.acf found: Unable to update" fn_scriptlog "Warning! Still no appmanifest_${appid}.acf found: Unable to update" exit 1 fi forceupdate=1 - fn_printwarn "No appmanifest_${appid}.acf found" + fn_print_warn "No appmanifest_${appid}.acf found" fn_scriptlog "Warning! No appmanifest_${appid}.acf found" sleep 2 - fn_printinfonl "Forcing update to correct issue" + fn_print_info_nl "Forcing update to correct issue" fn_scriptlog "Forcing update to correct issue" sleep 1 update_dl.sh @@ -73,12 +73,12 @@ fi fn_logupdaterequest(){ # Checks for server update requests from server logs. -fn_printdots "Checking for update: Server logs" +fn_print_dots "Checking for update: Server logs" fn_scriptlog "Checking for update: Server logs" sleep 1 requestrestart=$(grep -Ec "MasterRequestRestart" "${consolelog}") if [ "${requestrestart}" -ge "1" ]; then - fn_printoknl "Checking for update: Server logs: Update requested" + fn_print_ok_nl "Checking for update: Server logs: Update requested" sleep 1 echo "" echo -ne "Applying update.\r" @@ -98,7 +98,7 @@ if [ "${requestrestart}" -ge "1" ]; then update_dl.sh fi else - fn_printok "Checking for update: Server logs: No update requested" + fn_print_ok "Checking for update: Server logs: No update requested" sleep 1 fi } @@ -106,7 +106,7 @@ fi fn_steamcmdcheck(){ fn_appmanifestcheck # Checks for server update from SteamCMD -fn_printdots "Checking for update: SteamCMD" +fn_print_dots "Checking for update: SteamCMD" fn_scriptlog "Checking for update: SteamCMD" sleep 1 @@ -122,14 +122,14 @@ if [ -f "${HOME}/Steam/appcache/appinfo.vdf" ]; then fi availablebuild=$(./steamcmd.sh +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +app_info_print "${appid}" +quit | grep -EA 1000 "^\s+\"branches\"$" | grep -EA 5 "^\s+\"public\"$" | grep -m 1 -EB 10 "^\s+}$" | grep -E "^\s+\"buildid\"\s+" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3) if [ -z "${availablebuild}" ]; then - fn_printfail "Checking for update: SteamCMD" + fn_print_fail "Checking for update: SteamCMD" fn_scriptlog "Failure! Checking for update: SteamCMD" sleep 1 - fn_printfailnl "Checking for update: SteamCMD: Not returning version info" + fn_print_fail_nl "Checking for update: SteamCMD: Not returning version info" fn_scriptlog "Failure! Checking for update: SteamCMD: Not returning version info" exit 1 else - fn_printok "Checking for update: SteamCMD" + fn_print_ok "Checking for update: SteamCMD" fn_scriptlog "Success! Checking for update: SteamCMD" sleep 1 fi @@ -172,7 +172,7 @@ else echo -e " Available version: \e[0;32m${availablebuild}\e[0;39m" echo -e " https://steamdb.info/app/${appid}/" echo -e "" - fn_printoknl "No update available" + fn_print_ok_nl "No update available" fn_scriptlog "Current build: ${currentbuild}" fn_scriptlog "Available build: ${availablebuild}" fi @@ -182,19 +182,19 @@ fi fn_teamspeak3_check(){ # Checks for server update from teamspeak.com using a mirror dl.4players.de -fn_printdots "Checking for update: teamspeak.com" +fn_print_dots "Checking for update: teamspeak.com" fn_scriptlog "Checking for update: teamspeak.com" sleep 1 # Gets currentbuild info # Checks currentbuild info is available, if fails a server restart will be forced to generate logs if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then - fn_printfail "Checking for update: teamspeak.com" + fn_print_fail "Checking for update: teamspeak.com" sleep 1 - fn_printfailnl "Checking for update: teamspeak.com: No logs with server version found" + fn_print_fail_nl "Checking for update: teamspeak.com: No logs with server version found" fn_scriptlog "Failure! Checking for update: teamspeak.com: No logs with server version found" sleep 2 - fn_printinfonl "Checking for update: teamspeak.com: Forcing server restart" + fn_print_info_nl "Checking for update: teamspeak.com: Forcing server restart" fn_scriptlog "Checking for update: teamspeak.com: Forcing server restart" sleep 2 command_stop.sh @@ -202,7 +202,7 @@ if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then sleep 2 # If still failing will exit if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then - fn_printfailnl "Checking for update: teamspeak.com: Still No logs with server version found" + fn_print_fail_nl "Checking for update: teamspeak.com: Still No logs with server version found" fn_scriptlog "Failure! Checking for update: teamspeak.com: Still No logs with server version found" exit 1 fi @@ -217,7 +217,7 @@ elif [ "${arch}" == "i386" ]||[ "${arch}" == "i686" ]; then ts3arch="x86" else echo "" - fn_printfailure "${arch} is an unsupported architecture" + fn_print_failure "${arch} is an unsupported architecture" exit 1 fi @@ -249,15 +249,15 @@ rm -f ".ts3_version_numbers.tmp" # Checks availablebuild info is available if [ -z "${availablebuild}" ]; then - fn_printfail "Checking for update: teamspeak.com" + fn_print_fail "Checking for update: teamspeak.com" fn_scriptlog "Checking for update: teamspeak.com" sleep 1 - fn_printfail "Checking for update: teamspeak.com: Not returning version info" + fn_print_fail "Checking for update: teamspeak.com: Not returning version info" fn_scriptlog "Failure! Checking for update: teamspeak.com: Not returning version info" sleep 2 exit 1 else - fn_printok "Checking for update: teamspeak.com" + fn_print_ok "Checking for update: teamspeak.com" fn_scriptlog "Success! Checking for update: teamspeak.com" sleep 1 fi @@ -303,14 +303,14 @@ else echo -e " Current version: \e[0;32m${currentbuild}\e[0;39m" echo -e " Available version: \e[0;32m${availablebuild}\e[0;39m" echo -e "" - fn_printoknl "No update available" + fn_print_ok_nl "No update available" fn_scriptlog "Current build: ${currentbuild}" fn_scriptlog "Available build: ${availablebuild}" fi } check.sh -fn_printdots "Checking for update" +fn_print_dots "Checking for update" if [ "${gamename}" == "Teamspeak 3" ]; then fn_teamspeak3_check elif [ "${engine}" == "goldsource" ]||[ "${forceupdate}" == "1" ]; then diff --git a/functions/update_dl.sh b/functions/update_dl.sh index 0c07fc31a..f23bd2c64 100644 --- a/functions/update_dl.sh +++ b/functions/update_dl.sh @@ -71,9 +71,9 @@ rm -rf "${rootdir}/teamspeak3-server_linux_${ts3arch}" check.sh info_config.sh -fn_printdots "Updating ${servername}" +fn_print_dots "Updating ${servername}" sleep 1 -fn_printoknl "Updating ${servername}" +fn_print_ok_nl "Updating ${servername}" fn_scriptlog "Updating ${servername}" sleep 1 if [ "${gamename}" == "Teamspeak 3" ]; then diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh index 61b326506..0fce4904c 100644 --- a/tests/tests_jc2server.sh +++ b/tests/tests_jc2server.sh @@ -325,7 +325,7 @@ echo "Description:" echo "change the buildid tricking SteamCMD to update." requiredstatus="OFFLINE" fn_setstatus -fn_printinfonl "changed buildid to 0." +fn_print_info_nl "changed buildid to 0." sed -i 's/[0-9]\+/0/' ${filesdir}/steamapps/appmanifest_${appid}.acf update_check.sh echo "" @@ -338,7 +338,7 @@ echo "Description:" echo "change the buildid tricking SteamCMD to update server while already running." requiredstatus="ONLINE" fn_setstatus -fn_printinfonl "changed buildid to 0." +fn_print_info_nl "changed buildid to 0." sed -i 's/[0-9]\+/0/' ${filesdir}/steamapps/appmanifest_${appid}.acf update_check.sh echo "" @@ -351,7 +351,7 @@ echo "Description:" echo "removing appmanifest file will cause script to repair." requiredstatus="OFFLINE" fn_setstatus -fn_printinfonl "removed appmanifest_${appid}.acf." +fn_print_info_nl "removed appmanifest_${appid}.acf." rm --verbose "${filesdir}/steamapps/appmanifest_${appid}.acf" update_check.sh echo "" @@ -433,7 +433,7 @@ echo "Description:" echo "run monitor while server is offline with no lockfile." requiredstatus="OFFLINE" fn_setstatus -fn_printinfonl "creating lockfile." +fn_print_info_nl "creating lockfile." date > "${rootdir}/${lockselfname}" (command_monitor.sh) echo "" @@ -449,7 +449,7 @@ fn_setstatus sed -i 's/[0-9]\+/0/' "${servercfgfullpath}" (command_monitor.sh) echo "" -fn_printinfonl "Reseting ${servercfg}." +fn_print_info_nl "Reseting ${servercfg}." install_config.sh echo "" echo "Test complete!" @@ -478,7 +478,7 @@ echo "" requiredstatus="OFFLINE" fn_setstatus sleep 1 -fn_printinfo "Tidying up directories." +fn_print_info "Tidying up directories." sleep 1 rm -rfv ${serverfiles} echo "END" diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh index b3207c368..cd7c94f23 100644 --- a/tests/tests_ts3server.sh +++ b/tests/tests_ts3server.sh @@ -345,7 +345,7 @@ echo "Description:" echo "run monitor while server is offline with no lockfile." requiredstatus="OFFLINE" fn_setstatus -fn_printinfonl "creating lockfile." +fn_print_info_nl "creating lockfile." date > "${rootdir}/${lockselfname}" (command_monitor.sh) echo "" @@ -361,7 +361,7 @@ fn_setstatus sed -i 's/[0-9]\+/0/' "${servercfgfullpath}" (command_monitor.sh) echo "" -fn_printinfonl "Reseting ${servercfg}." +fn_print_info_nl "Reseting ${servercfg}." install_config.sh echo "" echo "Test complete!" @@ -390,7 +390,7 @@ echo "" requiredstatus="OFFLINE" fn_setstatus sleep 1 -fn_printinfo "Tidying up directories." +fn_print_info "Tidying up directories." sleep 1 rm -rfv ${serverfiles} echo "END" \ No newline at end of file