committed by
GitHub
82 changed files with 2166 additions and 1741 deletions
@ -1,17 +1,21 @@ |
|||||
#!/bin/bash |
#!/bin/bash |
||||
# LGSM dev_debug.sh function |
# LGSM command_dev_debug.sh function |
||||
# Author: Daniel Gibbs |
# Author: Daniel Gibbs |
||||
# Website: https://gameservermanagers.com |
# Website: https://gameservermanagers.com |
||||
lgsm_version="210516" |
|
||||
|
|
||||
# Description: Dev only: enables debuging log to be saved to dev-debug.log. |
# Description: Dev only: enables debuging log to be saved to dev-debug.log. |
||||
|
|
||||
function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" |
local commandname="DEV-DEBUG" |
||||
|
local commandaction="Dev-Debug" |
||||
|
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" |
||||
|
|
||||
|
|
||||
if [ -f ".dev-debug" ]; then |
if [ -f "${rootdir}/.dev-debug" ]; then |
||||
rm .dev-debug |
rm "${rootdir}/.dev-debug" |
||||
fn_print_ok_nl "Disabled dev-debug" |
fn_print_ok_nl "Disabled dev-debug" |
||||
|
fn_script_log_info "Disabled dev-debug" |
||||
else |
else |
||||
date > .dev-debug |
date > "${rootdir}/.dev-debug" |
||||
fn_print_ok_nl "Enabled dev-debug" |
fn_print_ok_nl "Enabled dev-debug" |
||||
fi |
fn_script_log_info "Enabled dev-debug" |
||||
|
fi |
||||
|
core_exit.sh |
@ -0,0 +1,14 @@ |
|||||
|
#!/bin/bash |
||||
|
# LGSM command_start.sh function |
||||
|
# Author: Daniel Gibbs |
||||
|
# Website: https://gameservermanagers.com |
||||
|
# Description: Starts the server. |
||||
|
|
||||
|
local commandname="RESTART" |
||||
|
local commandaction="Restarting" |
||||
|
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" |
||||
|
|
||||
|
info_config.sh |
||||
|
exitbypass=1 |
||||
|
command_stop.sh |
||||
|
command_start.sh |
@ -1,15 +1,17 @@ |
|||||
#!/bin/bash |
#!/bin/bash |
||||
# LGSM command_email_test.sh function |
# LGSM command_test_alert.sh function |
||||
# Author: Daniel Gibbs |
# Author: Daniel Gibbs |
||||
# Website: https://gameservermanagers.com |
# Website: https://gameservermanagers.com |
||||
lgsm_version="210516" |
|
||||
|
|
||||
# Description: Sends a test email alert. |
# Description: Sends a test email alert. |
||||
|
|
||||
local modulename="Alert" |
local commandname="ALERT" |
||||
function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" |
local commandaction="Alert" |
||||
|
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" |
||||
|
|
||||
|
fn_print_dots "${servername}" |
||||
|
sleep 1 |
||||
check.sh |
check.sh |
||||
info_config.sh |
info_config.sh |
||||
alert="test" |
alert="test" |
||||
alert.sh |
alert.sh |
||||
|
core_exit.sh |
||||
|
@ -0,0 +1,22 @@ |
|||||
|
#!/bin/bash |
||||
|
# LGSM command_update.sh function |
||||
|
# Author: Daniel Gibbs |
||||
|
# Website: https://gameservermanagers.com |
||||
|
# Description: Handles updating of servers. |
||||
|
|
||||
|
local commandname="UPDATE" |
||||
|
local commandaction="Update" |
||||
|
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" |
||||
|
|
||||
|
fn_print_dots "" |
||||
|
sleep 0.5 |
||||
|
check.sh |
||||
|
|
||||
|
|
||||
|
if [ "${gamename}" == "Teamspeak 3" ]; then |
||||
|
update_ts3.sh |
||||
|
else |
||||
|
update_steamcmd.sh |
||||
|
fi |
||||
|
|
||||
|
core_exit.sh |
@ -0,0 +1,38 @@ |
|||||
|
#!/bin/bash |
||||
|
# LGSM core_exit.sh function |
||||
|
# Author: Daniel Gibbs |
||||
|
# Website: https://gameservermanagers.com |
||||
|
# Description: handles exiting of LGSM by running and reporting an exit code. |
||||
|
|
||||
|
fn_exit_dev_debug(){ |
||||
|
if [ -f "${rootdir}/.dev-debug" ]; then |
||||
|
echo "" |
||||
|
echo "${function_selfname} exiting with code: ${exitcode}" |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
if [ -n "${exitbypass}" ]; then |
||||
|
unset exitbypass |
||||
|
elif [ -n "${exitcode}" ]&&[ "${exitcode}" != "0" ]; then |
||||
|
if [ "${exitcode}" == "1" ]; then |
||||
|
fn_script_log_fatal "${function_selfname} exiting with code: ${exitcode}" |
||||
|
elif [ "${exitcode}" == "2" ]; then |
||||
|
fn_script_log_error "${function_selfname} exiting with code: ${exitcode}" |
||||
|
elif [ "${exitcode}" == "3" ]; then |
||||
|
fn_script_log_warn "${function_selfname} exiting with code: ${exitcode}" |
||||
|
else |
||||
|
fn_script_log_warn "${function_selfname} exiting with code: ${exitcode}" |
||||
|
fi |
||||
|
fn_exit_dev_debug |
||||
|
# remove trap. |
||||
|
trap - INT |
||||
|
exit ${exitcode} |
||||
|
else |
||||
|
exitcode=0 |
||||
|
fn_script_log_pass "${function_selfname} exiting with code: ${exitcode}" |
||||
|
fn_exit_dev_debug |
||||
|
# remove trap. |
||||
|
trap - INT |
||||
|
exit ${exitcode} |
||||
|
fi |
||||
|
|
@ -1,204 +1,331 @@ |
|||||
#!/bin/bash |
#!/bin/bash |
||||
# LGSM fn_messages function |
# LGSM core_messages.sh function |
||||
# Author: Daniel Gibbs |
# Author: Daniel Gibbs |
||||
# Website: https://gameservermanagers.com |
# Website: https://gameservermanagers.com |
||||
lgsm_version="210516" |
|
||||
|
|
||||
# Description: Defines on-screen messages such as [ OK ] and how script logs look. |
# Description: Defines on-screen messages such as [ OK ] and how script logs look. |
||||
|
|
||||
# nl: new line: message is following by a new line |
# nl: new line: message is following by a new line |
||||
# eol: end of line: message is placed at the end of the current line |
# eol: end of line: message is placed at the end of the current line |
||||
|
|
||||
# Date, servicename & module details displayed in log files. |
if [ "${ansi}" != "off" ]; then |
||||
# e.g Feb 28 14:56:58 ut99-server: Monitor: |
# echo colors |
||||
fn_scriptlog(){ |
default="\e[0m" |
||||
if [ -n "${modulename}" ]; then |
red="\e[31m" |
||||
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${modulename}: ${1}" >> "${scriptlog}" |
green="\e[32m" |
||||
|
yellow="\e[33m" |
||||
|
blue="\e[34m" |
||||
|
magenta="\e[35m" |
||||
|
cyan="\e[36m" |
||||
|
lightyellow="\e[93m" |
||||
|
# carriage return & erase to end of line |
||||
|
creeol="\r\033[K" |
||||
|
fi |
||||
|
|
||||
|
# Log display |
||||
|
########## |
||||
|
## Feb 28 14:56:58 ut99-server: Monitor: |
||||
|
fn_script_log(){ |
||||
|
if [ -n "${commandaction}" ]; then |
||||
|
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${commandaction}: ${1}" >> "${scriptlog}" |
||||
else |
else |
||||
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${1}" >> "${scriptlog}" |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${1}" >> "${scriptlog}" |
||||
fi |
fi |
||||
} |
} |
||||
|
|
||||
# [ FAIL ] |
## Feb 28 14:56:58 ut99-server: Monitor: PASS: |
||||
fn_print_fail(){ |
fn_script_log_pass(){ |
||||
if [ -n "${modulename}" ]; then |
if [ -n "${commandaction}" ]; then |
||||
echo -en "\r\033[K[\e[0;31m FAIL \e[0m] ${modulename} ${servicename}: $@" |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${commandaction}: PASS: ${1}" >> "${scriptlog}" |
||||
else |
else |
||||
echo -en "\r\033[K[\e[0;31m FAIL \e[0m] $@" |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: PASS: ${1}" >> "${scriptlog}" |
||||
fi |
fi |
||||
|
exitcode=0 |
||||
} |
} |
||||
|
|
||||
fn_print_fail_nl(){ |
## Feb 28 14:56:58 ut99-server: Monitor: FATAL: |
||||
if [ -n "${modulename}" ]; then |
fn_script_log_fatal(){ |
||||
echo -en "\r\033[K[\e[0;31m FAIL \e[0m] ${modulename} ${servicename}: $@" |
if [ -n "${commandaction}" ]; then |
||||
|
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${commandaction}: FATAL: ${1}" >> "${scriptlog}" |
||||
|
else |
||||
|
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: FATAL: ${1}" >> "${scriptlog}" |
||||
|
fi |
||||
|
exitcode=1 |
||||
|
} |
||||
|
|
||||
|
## Feb 28 14:56:58 ut99-server: Monitor: ERROR: |
||||
|
fn_script_log_error(){ |
||||
|
if [ -n "${commandaction}" ]; then |
||||
|
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${commandaction}: ERROR: ${1}" >> "${scriptlog}" |
||||
|
else |
||||
|
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ERROR: ${1}" >> "${scriptlog}" |
||||
|
fi |
||||
|
exitcode=2 |
||||
|
} |
||||
|
|
||||
|
## Feb 28 14:56:58 ut99-server: Monitor: WARN: |
||||
|
fn_script_log_warn(){ |
||||
|
if [ -n "${commandaction}" ]; then |
||||
|
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${commandaction}: WARN: ${1}" >> "${scriptlog}" |
||||
|
else |
||||
|
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: WARN: ${1}" >> "${scriptlog}" |
||||
|
fi |
||||
|
exitcode=3 |
||||
|
} |
||||
|
|
||||
|
## Feb 28 14:56:58 ut99-server: Monitor: INFO: |
||||
|
fn_script_log_info(){ |
||||
|
if [ -n "${commandaction}" ]; then |
||||
|
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${commandaction}: INFO: ${1}" >> "${scriptlog}" |
||||
|
else |
||||
|
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: INFO: ${1}" >> "${scriptlog}" |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
# On-Screen |
||||
|
########## |
||||
|
|
||||
|
# [ .... ] |
||||
|
fn_print_dots(){ |
||||
|
if [ -n "${commandaction}" ]; then |
||||
|
echo -en "${creeol}[ .... ] ${commandaction} ${servicename}: $@" |
||||
|
else |
||||
|
echo -en "${creeol}[ .... ] $@" |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
fn_print_dots_nl(){ |
||||
|
if [ -n "${commandaction}" ]; then |
||||
|
echo -e "${creeol}[ .... ] ${commandaction} ${servicename}: $@" |
||||
else |
else |
||||
echo -en "\r\033[K[\e[0;31m FAIL \e[0m] $@" |
echo -e "${creeol}[ .... ] $@" |
||||
fi |
fi |
||||
sleep 1 |
sleep 0.5 |
||||
echo -en "\n" |
echo -en "\n" |
||||
} |
} |
||||
|
|
||||
# [ OK ] |
# [ OK ] |
||||
fn_print_ok(){ |
fn_print_ok(){ |
||||
if [ -n "${modulename}" ]; then |
if [ -n "${commandaction}" ]; then |
||||
echo -en "\r\033[K[\e[0;32m OK \e[0m] ${modulename} ${servicename}: $@" |
echo -en "${creeol}[${green} OK ${default}] ${commandaction} ${servicename}: $@" |
||||
else |
else |
||||
echo -en "\r\033[K[\e[0;32m OK \e[0m] $@" |
echo -en "${creeol}[${green} OK ${default}] $@" |
||||
fi |
fi |
||||
} |
} |
||||
|
|
||||
fn_print_ok_nl(){ |
fn_print_ok_nl(){ |
||||
if [ -n "${modulename}" ]; then |
if [ -n "${commandaction}" ]; then |
||||
echo -en "\r\033[K[\e[0;32m OK \e[0m] ${modulename} ${servicename}: $@" |
echo -en "${creeol}[${green} OK ${default}] ${commandaction} ${servicename}: $@" |
||||
else |
else |
||||
echo -en "\r\033[K[\e[0;32m OK \e[0m] $@" |
echo -en "${creeol}[${green} OK ${default}] $@" |
||||
fi |
fi |
||||
sleep 1 |
sleep 0.5 |
||||
echo -en "\n" |
echo -en "\n" |
||||
} |
} |
||||
|
|
||||
# [ INFO ] |
# [ FAIL ] |
||||
fn_print_info(){ |
fn_print_fail(){ |
||||
if [ -n "${modulename}" ]; then |
if [ -n "${commandaction}" ]; then |
||||
echo -en "\r\033[K[\e[0;36m INFO \e[0m] ${modulename} ${servicename}: $@" |
echo -en "${creeol}[${red} FAIL ${default}] ${commandaction} ${servicename}: $@" |
||||
else |
else |
||||
echo -en "\r\033[K[\e[0;36m INFO \e[0m] $@" |
echo -en "${creeol}[${red} FAIL ${default}] $@" |
||||
fi |
fi |
||||
} |
} |
||||
|
|
||||
fn_print_info_nl(){ |
fn_print_fail_nl(){ |
||||
if [ -n "${modulename}" ]; then |
if [ -n "${commandaction}" ]; then |
||||
echo -en "\r\033[K[\e[0;36m INFO \e[0m] ${modulename} ${servicename}: $@" |
echo -en "${creeol}[${red} FAIL ${default}] ${commandaction} ${servicename}: $@" |
||||
|
else |
||||
|
echo -en "${creeol}[${red} FAIL ${default}] $@" |
||||
|
fi |
||||
|
sleep 0.5 |
||||
|
echo -en "\n" |
||||
|
} |
||||
|
|
||||
|
# [ ERROR ] |
||||
|
fn_print_error(){ |
||||
|
if [ -n "${commandaction}" ]; then |
||||
|
echo -en "${creeol}[${red}ERROR ${default}] ${commandaction} ${servicename}: $@" |
||||
|
else |
||||
|
echo -en "${creeol}[${red}ERROR ${default}] $@" |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
fn_print_error_nl(){ |
||||
|
if [ -n "${commandaction}" ]; then |
||||
|
echo -en "${creeol}[${red}ERROR ${default}] ${commandaction} ${servicename}: $@" |
||||
else |
else |
||||
echo -en "\r\033[K[\e[0;36m INFO \e[0m] $@" |
echo -en "${creeol}[${red}ERROR ${default}] $@" |
||||
fi |
fi |
||||
sleep 1 |
sleep 0.5 |
||||
echo -en "\n" |
echo -en "\n" |
||||
} |
} |
||||
|
|
||||
# [ WARN ] |
# [ WARN ] |
||||
fn_print_warn(){ |
fn_print_warn(){ |
||||
if [ -n "${modulename}" ]; then |
if [ -n "${commandaction}" ]; then |
||||
echo -en "\r\033[K[\e[1;33m WARN \e[0m] ${modulename} ${servicename}: $@" |
echo -en "${creeol}[${yellow} WARN ${default}] ${commandaction} ${servicename}: $@" |
||||
else |
else |
||||
echo -en "\r\033[K[\e[1;33m WARN \e[0m] $@" |
echo -en "${creeol}[${yellow} WARN ${default}] $@" |
||||
fi |
fi |
||||
} |
} |
||||
|
|
||||
fn_print_warn_nl(){ |
fn_print_warn_nl(){ |
||||
if [ -n "${modulename}" ]; then |
if [ -n "${commandaction}" ]; then |
||||
echo -en "\r\033[K[\e[1;33m WARN \e[0m] ${modulename} ${servicename}: $@" |
echo -en "${creeol}[${yellow} WARN ${default}] ${commandaction} ${servicename}: $@" |
||||
else |
else |
||||
echo -en "\r\033[K[\e[1;33m WARN \e[0m] $@" |
echo -en "${creeol}[${yellow} WARN ${default}] $@" |
||||
fi |
fi |
||||
sleep 1 |
sleep 0.5 |
||||
echo -en "\n" |
echo -en "\n" |
||||
} |
} |
||||
|
|
||||
# [ .... ] |
# [ INFO ] |
||||
fn_print_dots(){ |
fn_print_info(){ |
||||
if [ -n "${modulename}" ]; then |
if [ -n "${commandaction}" ]; then |
||||
echo -en "\r\033[K[ .... ] ${modulename} ${servicename}: $@" |
echo -en "${creeol}[${cyan} INFO ${default}] ${commandaction} ${servicename}: $@" |
||||
else |
else |
||||
echo -en "\r\033[K[ .... ] $@" |
echo -en "${creeol}[${cyan} INFO ${default}] $@" |
||||
fi |
fi |
||||
} |
} |
||||
|
|
||||
# Complete! |
fn_print_info_nl(){ |
||||
fn_print_complete(){ |
if [ -n "${commandaction}" ]; then |
||||
echo -en "\e[0;32mComplete!\e[0m $@" |
echo -en "${creeol}[${cyan} INFO ${default}] ${commandaction} ${servicename}: $@" |
||||
|
else |
||||
|
echo -en "${creeol}[${cyan} INFO ${default}] $@" |
||||
|
fi |
||||
|
sleep 0.5 |
||||
|
echo -en "\n" |
||||
} |
} |
||||
|
|
||||
fn_print_complete_nl(){ |
# On-Screen full word |
||||
echo -e "\e[0;32mComplete!\e[0m $@" |
########## |
||||
} |
|
||||
|
|
||||
# Warning! |
# Complete! |
||||
fn_print_warning(){ |
fn_print_complete(){ |
||||
echo -en "\e[0;33mWarning!\e[0m $@" |
echo -en "${green}Complete!${default} $@" |
||||
} |
} |
||||
|
|
||||
fn_print_warning_nl(){ |
fn_print_complete_nl(){ |
||||
echo -e "\e[0;33mWarning!\e[0m $@" |
echo -e "${green}Complete!${default} $@" |
||||
} |
} |
||||
|
|
||||
# Failure! |
# Failure! |
||||
fn_print_failure(){ |
fn_print_failure(){ |
||||
echo -en "\e[0;31mFailure!\e[0m $@" |
echo -en "${red}Failure!${default} $@" |
||||
} |
} |
||||
|
|
||||
fn_print_failure_nl(){ |
fn_print_failure_nl(){ |
||||
echo -e "\e[0;31mFailure!\e[0m $@" |
echo -e "${red}Failure!${default} $@" |
||||
} |
} |
||||
|
|
||||
# Error! |
# Error! |
||||
fn_print_error(){ |
fn_print_error2(){ |
||||
echo -en "\e[0;31mError!\e[0m $@" |
echo -en "${red}Error!${default} $@" |
||||
} |
} |
||||
|
|
||||
fn_print_error_nl(){ |
fn_print_error2_nl(){ |
||||
echo -e "\e[0;31mError!\e[0m $@" |
echo -e "${red}Error!${default} $@" |
||||
|
} |
||||
|
|
||||
|
# Warning! |
||||
|
fn_print_warning(){ |
||||
|
echo -en "${yellow}Warning!${default} $@" |
||||
|
} |
||||
|
|
||||
|
fn_print_warning_nl(){ |
||||
|
echo -e "${yellow}Warning!${default} $@" |
||||
} |
} |
||||
|
|
||||
# Infomation! |
# Infomation! |
||||
fn_print_infomation(){ |
fn_print_infomation(){ |
||||
echo -en "\e[0;36mInfomation!\e[0m $@" |
echo -en "${cyan}Infomation!${default} $@" |
||||
} |
} |
||||
|
|
||||
fn_print_infomation_nl(){ |
fn_print_infomation_nl(){ |
||||
echo -e "\e[0;36mInfomation!\e[0m $@" |
echo -e "${cyan}Infomation!${default} $@" |
||||
} |
} |
||||
|
|
||||
# FAIL for end of line |
# On-Screen End of Line |
||||
|
########## |
||||
|
|
||||
|
# OK |
||||
fn_print_ok_eol(){ |
fn_print_ok_eol(){ |
||||
echo -en "\e[0;32mOK\e[0m" |
echo -en "${green}OK${default}" |
||||
} |
} |
||||
|
|
||||
fn_print_ok_eol_nl(){ |
fn_print_ok_eol_nl(){ |
||||
echo -e "\e[0;32mOK\e[0m" |
echo -e "${green}OK${default}" |
||||
} |
} |
||||
|
|
||||
# FAIL for end of line |
# FAIL |
||||
fn_print_fail_eol(){ |
fn_print_fail_eol(){ |
||||
echo -en "\e[0;31mFAIL\e[0m" |
echo -en "${red}FAIL${default}" |
||||
} |
} |
||||
|
|
||||
fn_print_fail_eol_nl(){ |
fn_print_fail_eol_nl(){ |
||||
echo -e "\e[0;31mFAIL\e[0m" |
echo -e "${red}FAIL${default}" |
||||
|
} |
||||
|
|
||||
|
# WARN |
||||
|
fn_print_warn_eol(){ |
||||
|
echo -en "${red}FAIL${default}" |
||||
} |
} |
||||
|
|
||||
# QUERYING for end of line |
fn_print_warn_eol_nl(){ |
||||
|
echo -e "${red}FAIL${default}" |
||||
|
} |
||||
|
|
||||
|
# INFO |
||||
|
fn_print_info_eol(){ |
||||
|
echo -en "${red}FAIL${default}" |
||||
|
} |
||||
|
|
||||
|
fn_print_info_eol_nl(){ |
||||
|
echo -e "${red}FAIL${default}" |
||||
|
} |
||||
|
|
||||
|
# QUERYING |
||||
fn_print_querying_eol(){ |
fn_print_querying_eol(){ |
||||
echo -en "\e[0;36mQUERYING\e[0m" |
echo -en "${cyan}QUERYING${default}" |
||||
} |
} |
||||
|
|
||||
fn_print_querying_eol_nl(){ |
fn_print_querying_eol_nl(){ |
||||
echo -e "\e[0;36mQUERYING\e[0m" |
echo -e "${cyan}QUERYING${default}" |
||||
} |
} |
||||
|
|
||||
# CHECKING for end of line |
# CHECKING |
||||
fn_print_checking_eol(){ |
fn_print_checking_eol(){ |
||||
echo -en "\e[0;36mCHECKING\e[0m" |
echo -en "${cyan}CHECKING${default}" |
||||
} |
} |
||||
|
|
||||
fn_print_checking_eol_nl(){ |
fn_print_checking_eol_nl(){ |
||||
echo -e "\e[0;36mCHECKING\e[0m" |
echo -e "${cyan}CHECKING${default}" |
||||
} |
} |
||||
|
|
||||
# CANCELED for end of line |
# CANCELED |
||||
fn_print_canceled_eol(){ |
fn_print_canceled_eol(){ |
||||
echo -en "\e[0;33mCANCELED\e[0m" |
echo -en "${yellow}CANCELED${default}" |
||||
} |
} |
||||
|
|
||||
fn_print_canceled_eol_nl(){ |
fn_print_canceled_eol_nl(){ |
||||
echo -e "\e[0;33mCANCELED\e[0m" |
echo -e "${yellow}CANCELED${default}" |
||||
} |
} |
||||
|
|
||||
# REMOVED for end of line |
# REMOVED |
||||
fn_print_removed_eol(){ |
fn_print_removed_eol(){ |
||||
echo -en "\e[0;31mREMOVED\e[0m" |
echo -en "${red}REMOVED${default}" |
||||
} |
} |
||||
|
|
||||
fn_print_removed_eol_nl(){ |
fn_print_removed_eol_nl(){ |
||||
echo -e "\e[0;31mREMOVED\e[0m" |
echo -e "${red}REMOVED${default}" |
||||
|
} |
||||
|
|
||||
|
# UPDATE |
||||
|
fn_print_update_eol(){ |
||||
|
echo -en "${cyan}UPDATE${default}" |
||||
|
} |
||||
|
|
||||
|
fn_print_update_eol_nl(){ |
||||
|
echo -e "${cyan}UPDATE${default}" |
||||
} |
} |
@ -0,0 +1,13 @@ |
|||||
|
#!/bin/bash |
||||
|
# LGSM core_trap.sh function |
||||
|
# Author: Daniel Gibbs |
||||
|
# Website: https://gameservermanagers.com |
||||
|
# Description: handles ctrl-C trap to give an exitcode. |
||||
|
|
||||
|
fn_exit_trap(){ |
||||
|
echo "" |
||||
|
core_exit.sh |
||||
|
} |
||||
|
|
||||
|
# trap to give an exitcode. |
||||
|
trap fn_exit_trap INT |
@ -1,81 +0,0 @@ |
|||||
#!/bin/bash |
|
||||
# LGSM install_ts3.sh function |
|
||||
# Author: Daniel Gibbs |
|
||||
# Website: https://gameservermanagers.com |
|
||||
lgsm_version="210516" |
|
||||
|
|
||||
local modulename="Install" |
|
||||
|
|
||||
info_distro.sh |
|
||||
# Gets the teamspeak server architecture |
|
||||
if [ "${arch}" == "x86_64" ]; then |
|
||||
ts3arch="amd64" |
|
||||
elif [ "${arch}" == "i386" ]||[ "${arch}" == "i686" ]; then |
|
||||
ts3arch="x86" |
|
||||
else |
|
||||
fn_print_failure "${arch} is an unsupported architecture" |
|
||||
exit 1 |
|
||||
fi |
|
||||
|
|
||||
# Grabs all version numbers but not in correct order |
|
||||
wget "http://dl.4players.de/ts/releases/?C=M;O=D" -q -O -| grep -i dir | egrep -o '<a href=\".*\/\">.*\/<\/a>' | egrep -o '[0-9\.?]+'|uniq > .ts3_version_numbers_unsorted.tmp |
|
||||
|
|
||||
# Sort version numbers |
|
||||
cat .ts3_version_numbers_unsorted.tmp | sort -r --version-sort -o .ts3_version_numbers_sorted.tmp |
|
||||
|
|
||||
# Finds directory with most recent server version. |
|
||||
while read ts3_version_number; do |
|
||||
wget --spider -q "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" |
|
||||
if [ $? -eq 0 ]; then |
|
||||
availablebuild="${ts3_version_number}" |
|
||||
# Break while-loop, if the latest release could be found |
|
||||
break |
|
||||
fi |
|
||||
done < .ts3_version_numbers_sorted.tmp |
|
||||
|
|
||||
# Tidy up |
|
||||
rm -f ".ts3_version_numbers_unsorted.tmp" |
|
||||
rm -f ".ts3_version_numbers_sorted.tmp" |
|
||||
|
|
||||
# Checks availablebuild info is available |
|
||||
if [ -z "${availablebuild}" ]; then |
|
||||
fn_print_fail "Checking for update: teamspeak.com" |
|
||||
sleep 1 |
|
||||
fn_print_fail "Checking for update: teamspeak.com: Not returning version info" |
|
||||
sleep 2 |
|
||||
exit 1 |
|
||||
fi |
|
||||
|
|
||||
echo "" |
|
||||
echo "Installing ${gamename} Server" |
|
||||
echo "=================================" |
|
||||
cd "${rootdir}" |
|
||||
echo -e "downloading teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2...\c" |
|
||||
wget -N /dev/null http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2 2>&1 | grep -F HTTP | cut -c45-| uniq |
|
||||
sleep 1 |
|
||||
echo -e "extracting teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2...\c" |
|
||||
tar -xf "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" 2> ".${servicename}-tar-error.tmp" |
|
||||
local status=$? |
|
||||
if [ ${status} -eq 0 ]; then |
|
||||
echo "OK" |
|
||||
else |
|
||||
echo "FAIL - Exit status ${status}" |
|
||||
sleep 1 |
|
||||
cat ".${servicename}-tar-error.tmp" |
|
||||
rm ".${servicename}-tar-error.tmp" |
|
||||
exit $? |
|
||||
fi |
|
||||
echo -e "copying to ${filesdir}...\c" |
|
||||
cp -R "${rootdir}/teamspeak3-server_linux_${ts3arch}/"* "${filesdir}" 2> ".${servicename}-cp-error.tmp" |
|
||||
local status=$? |
|
||||
if [ ${status} -eq 0 ]; then |
|
||||
echo "OK" |
|
||||
else |
|
||||
echo "FAIL - Exit status ${status}" |
|
||||
sleep 1 |
|
||||
cat ".${servicename}-cp-error.tmp" |
|
||||
rm ".${servicename}-cp-error.tmp" |
|
||||
exit $? |
|
||||
fi |
|
||||
rm -f "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" |
|
||||
rm -rf "${rootdir}/teamspeak3-server_linux_${ts3arch}" |
|
@ -1,342 +0,0 @@ |
|||||
#!/bin/bash |
|
||||
# LGSM update_check.sh function |
|
||||
# Author: Daniel Gibbs |
|
||||
# Website: https://gameservermanagers.com |
|
||||
lgsm_version="210516" |
|
||||
|
|
||||
# Description: Checks if a server update is available. |
|
||||
|
|
||||
local modulename="Update" |
|
||||
function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" |
|
||||
|
|
||||
### SteamCMD Update Checker ### |
|
||||
|
|
||||
fn_appmanifestinfo(){ |
|
||||
appmanifestfile=$(find "${filesdir}" -type f -name "appmanifest_${appid}.acf") |
|
||||
appmanifestfilewc=$(find "${filesdir}" -type f -name "appmanifest_${appid}.acf"|wc -l) |
|
||||
} |
|
||||
|
|
||||
fn_appmanifestcheck(){ |
|
||||
fn_appmanifestinfo |
|
||||
# Multiple or no matching appmanifest files may sometimes be available. |
|
||||
# This is an error is corrected below if required. |
|
||||
if [ "${appmanifestfilewc}" -ge "2" ]; then |
|
||||
sleep 1 |
|
||||
fn_print_warn "Multiple appmanifest_${appid}.acf files found" |
|
||||
fn_scriptlog "Warning! Multiple appmanifest_${appid}.acf files found" |
|
||||
sleep 2 |
|
||||
fn_print_dots "Removing x${appmanifestfilewc} appmanifest_${appid}.acf files" |
|
||||
sleep 1 |
|
||||
for appfile in ${appmanifestfile}; do |
|
||||
rm "${appfile}" |
|
||||
done |
|
||||
appmanifestfilewc1="${appmanifestfilewc}" |
|
||||
fn_appmanifestinfo |
|
||||
if [ "${appmanifestfilewc}" -ge "2" ]; then |
|
||||
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 "" |
|
||||
echo " Check user permissions" |
|
||||
for appfile in ${appmanifestfile}; do |
|
||||
echo " ${appfile}" |
|
||||
done |
|
||||
exit 1 |
|
||||
else |
|
||||
sleep 1 |
|
||||
fn_print_ok "Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files" |
|
||||
fn_scriptlog "Success! Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files" |
|
||||
sleep 1 |
|
||||
fn_print_info_nl "Forcing update to correct issue" |
|
||||
fn_scriptlog "Forcing update to correct issue" |
|
||||
sleep 1 |
|
||||
update_dl.sh |
|
||||
update_check.sh |
|
||||
fi |
|
||||
elif [ "${appmanifestfilewc}" -eq "0" ]; then |
|
||||
if [ "${forceupdate}" == "1" ]; then |
|
||||
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_print_warn "No appmanifest_${appid}.acf found" |
|
||||
fn_scriptlog "Warning! No appmanifest_${appid}.acf found" |
|
||||
sleep 2 |
|
||||
fn_print_info_nl "Forcing update to correct issue" |
|
||||
fn_scriptlog "Forcing update to correct issue" |
|
||||
sleep 1 |
|
||||
update_dl.sh |
|
||||
update_check.sh |
|
||||
fi |
|
||||
} |
|
||||
|
|
||||
fn_logupdaterequest(){ |
|
||||
# Checks for server update requests from 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_print_ok_nl "Checking for update: Server logs: Update requested" |
|
||||
sleep 1 |
|
||||
echo "" |
|
||||
echo -ne "Applying update.\r" |
|
||||
sleep 1 |
|
||||
echo -ne "Applying update..\r" |
|
||||
sleep 1 |
|
||||
echo -ne "Applying update...\r" |
|
||||
sleep 1 |
|
||||
echo -ne "\n" |
|
||||
|
|
||||
unset updateonstart |
|
||||
check_status.sh |
|
||||
if [ "${status}" != "0" ]; then |
|
||||
command_stop.sh |
|
||||
update_dl.sh |
|
||||
command_start.sh |
|
||||
else |
|
||||
update_dl.sh |
|
||||
fi |
|
||||
alert="update" |
|
||||
alert.sh |
|
||||
else |
|
||||
fn_print_ok "Checking for update: Server logs: No update requested" |
|
||||
sleep 1 |
|
||||
fi |
|
||||
} |
|
||||
|
|
||||
fn_steamcmdcheck(){ |
|
||||
fn_appmanifestcheck |
|
||||
# Checks for server update from SteamCMD |
|
||||
fn_print_dots "Checking for update: SteamCMD" |
|
||||
fn_scriptlog "Checking for update: SteamCMD" |
|
||||
sleep 1 |
|
||||
|
|
||||
# Gets currentbuild |
|
||||
currentbuild=$(grep buildid "${appmanifestfile}" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3) |
|
||||
|
|
||||
# Removes appinfo.vdf as a fix for not always getting up to date version info from SteamCMD |
|
||||
|
|
||||
# Gets availablebuild info |
|
||||
cd "${rootdir}/steamcmd" |
|
||||
if [ -f "${HOME}/Steam/appcache/appinfo.vdf" ]; then |
|
||||
rm -f "${HOME}/Steam/appcache/appinfo.vdf" |
|
||||
fi |
|
||||
|
|
||||
# set branch for updateinfo |
|
||||
IFS=' ' read -a branchsplits <<< "${branch}" |
|
||||
if [ "${#branchsplits[@]}" -gt 1 ]; then |
|
||||
branchname="${branchsplits[1]}" |
|
||||
else |
|
||||
branchname="public" |
|
||||
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+\"${branchname}\"$" | grep -m 1 -EB 10 "^\s+}$" | grep -E "^\s+\"buildid\"\s+" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3) |
|
||||
if [ -z "${availablebuild}" ]; then |
|
||||
fn_print_fail "Checking for update: SteamCMD" |
|
||||
fn_scriptlog "Failure! Checking for update: SteamCMD" |
|
||||
sleep 1 |
|
||||
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_print_ok "Checking for update: SteamCMD" |
|
||||
fn_scriptlog "Success! Checking for update: SteamCMD" |
|
||||
sleep 1 |
|
||||
fi |
|
||||
|
|
||||
if [ "${currentbuild}" != "${availablebuild}" ]; then |
|
||||
echo -e "\n" |
|
||||
echo -e "Update available:" |
|
||||
sleep 1 |
|
||||
echo -e " Current build: \e[0;31m${currentbuild}\e[0;39m" |
|
||||
echo -e " Available build: \e[0;32m${availablebuild}\e[0;39m" |
|
||||
echo -e "" |
|
||||
echo -e " https://steamdb.info/app/${appid}/" |
|
||||
sleep 1 |
|
||||
echo "" |
|
||||
echo -en "Applying update.\r" |
|
||||
sleep 1 |
|
||||
echo -en "Applying update..\r" |
|
||||
sleep 1 |
|
||||
echo -en "Applying update...\r" |
|
||||
sleep 1 |
|
||||
echo -en "\n" |
|
||||
fn_scriptlog "Update available" |
|
||||
fn_scriptlog "Current build: ${currentbuild}" |
|
||||
fn_scriptlog "Available build: ${availablebuild}" |
|
||||
fn_scriptlog "${currentbuild} > ${availablebuild}" |
|
||||
|
|
||||
unset updateonstart |
|
||||
check_status.sh |
|
||||
if [ "${status}" != "0" ]; then |
|
||||
command_stop.sh |
|
||||
update_dl.sh |
|
||||
command_start.sh |
|
||||
else |
|
||||
update_dl.sh |
|
||||
fi |
|
||||
alert="update" |
|
||||
alert.sh |
|
||||
else |
|
||||
echo -e "\n" |
|
||||
echo -e "No update available:" |
|
||||
echo -e " Current version: \e[0;32m${currentbuild}\e[0;39m" |
|
||||
echo -e " Available version: \e[0;32m${availablebuild}\e[0;39m" |
|
||||
echo -e " https://steamdb.info/app/${appid}/" |
|
||||
echo -e "" |
|
||||
fn_print_ok_nl "No update available" |
|
||||
fn_scriptlog "Current build: ${currentbuild}" |
|
||||
fn_scriptlog "Available build: ${availablebuild}" |
|
||||
fi |
|
||||
} |
|
||||
|
|
||||
### END SteamCMD Update Checker ### |
|
||||
|
|
||||
fn_teamspeak3_check(){ |
|
||||
# Checks for server update from teamspeak.com using a mirror dl.4players.de |
|
||||
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_print_fail "Checking for update: teamspeak.com" |
|
||||
sleep 1 |
|
||||
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_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 |
|
||||
command_start.sh |
|
||||
sleep 2 |
|
||||
# If still failing will exit |
|
||||
if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then |
|
||||
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 |
|
||||
fi |
|
||||
currentbuild=$(cat $(find ./* -name 'ts3server*_0.log' 2> /dev/null | sort | egrep -E -v '${rootdir}/.ts3version' | tail -1) | egrep -o 'TeamSpeak 3 Server ((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}' | egrep -o '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}') |
|
||||
|
|
||||
# Gets the teamspeak server architecture |
|
||||
info_distro.sh |
|
||||
if [ "${arch}" == "x86_64" ]; then |
|
||||
ts3arch="amd64" |
|
||||
elif [ "${arch}" == "i386" ]||[ "${arch}" == "i686" ]; then |
|
||||
ts3arch="x86" |
|
||||
else |
|
||||
echo "" |
|
||||
fn_print_failure "${arch} is an unsupported architecture" |
|
||||
exit 1 |
|
||||
fi |
|
||||
|
|
||||
# Gets availablebuild info |
|
||||
|
|
||||
# Grabs all version numbers but not in correct order |
|
||||
wget "http://dl.4players.de/ts/releases/?C=M;O=D" -q -O -| grep -i dir | egrep -o '<a href=\".*\/\">.*\/<\/a>' | egrep -o '[0-9\.?]+'|uniq > .ts3_version_numbers_unsorted.tmp |
|
||||
|
|
||||
# Sort version numbers |
|
||||
cat .ts3_version_numbers_unsorted.tmp | sort -r --version-sort -o .ts3_version_numbers_sorted.tmp |
|
||||
|
|
||||
# Finds directory with most recent server version. |
|
||||
while read ts3_version_number; do |
|
||||
wget --spider -q "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" |
|
||||
if [ $? -eq 0 ]; then |
|
||||
availablebuild="${ts3_version_number}" |
|
||||
# Break while-loop, if the latest release could be found |
|
||||
break |
|
||||
fi |
|
||||
done < .ts3_version_numbers_sorted.tmp |
|
||||
|
|
||||
# Tidy up |
|
||||
rm -f ".ts3_version_numbers_unsorted.tmp" |
|
||||
rm -f ".ts3_version_numbers_sorted.tmp" |
|
||||
|
|
||||
# Checks availablebuild info is available |
|
||||
if [ -z "${availablebuild}" ]; then |
|
||||
fn_print_fail "Checking for update: teamspeak.com" |
|
||||
fn_scriptlog "Checking for update: teamspeak.com" |
|
||||
sleep 1 |
|
||||
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_print_ok "Checking for update: teamspeak.com" |
|
||||
fn_scriptlog "Success! Checking for update: teamspeak.com" |
|
||||
sleep 1 |
|
||||
fi |
|
||||
|
|
||||
# Removes dots so if can compare version numbers |
|
||||
currentbuilddigit=$(echo "${currentbuild}"|tr -cd '[:digit:]') |
|
||||
availablebuilddigit=$(echo "${availablebuild}"|tr -cd '[:digit:]') |
|
||||
if [ "${currentbuilddigit}" -ne "${availablebuilddigit}" ]; then |
|
||||
echo -e "\n" |
|
||||
echo -e "Update available:" |
|
||||
sleep 1 |
|
||||
echo -e " Current build: \e[0;31m${currentbuild} ${architecture}\e[0;39m" |
|
||||
echo -e " Available build: \e[0;32m${availablebuild} ${architecture}\e[0;39m" |
|
||||
echo -e "" |
|
||||
sleep 1 |
|
||||
echo "" |
|
||||
echo -en "Applying update.\r" |
|
||||
sleep 1 |
|
||||
echo -en "Applying update..\r" |
|
||||
sleep 1 |
|
||||
echo -en "Applying update...\r" |
|
||||
sleep 1 |
|
||||
echo -en "\n" |
|
||||
fn_scriptlog "Update available" |
|
||||
fn_scriptlog "Current build: ${currentbuild}" |
|
||||
fn_scriptlog "Available build: ${availablebuild}" |
|
||||
fn_scriptlog "${currentbuild} > ${availablebuild}" |
|
||||
|
|
||||
unset updateonstart |
|
||||
check_status.sh |
|
||||
if [ "${status}" == "0" ]; then |
|
||||
update_dl.sh |
|
||||
command_start.sh |
|
||||
sleep 5 |
|
||||
command_stop.sh |
|
||||
else |
|
||||
command_stop.sh |
|
||||
update_dl.sh |
|
||||
command_start.sh |
|
||||
fi |
|
||||
alert="update" |
|
||||
alert.sh |
|
||||
else |
|
||||
echo -e "\n" |
|
||||
echo -e "No update available:" |
|
||||
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_print_ok_nl "No update available" |
|
||||
fn_scriptlog "Current build: ${currentbuild}" |
|
||||
fn_scriptlog "Available build: ${availablebuild}" |
|
||||
fi |
|
||||
} |
|
||||
|
|
||||
check.sh |
|
||||
fn_print_dots "Checking for update" |
|
||||
if [ "${gamename}" == "Teamspeak 3" ]; then |
|
||||
fn_teamspeak3_check |
|
||||
elif [ "${engine}" == "goldsource" ]||[ "${forceupdate}" == "1" ]; then |
|
||||
# Goldsource servers bypass checks as fn_steamcmdcheck does not work for appid 90 servers. |
|
||||
# forceupdate bypasses checks |
|
||||
if [ "${status}" != "0" ]; then |
|
||||
command_stop.sh |
|
||||
update_dl.sh |
|
||||
command_start.sh |
|
||||
else |
|
||||
update_dl.sh |
|
||||
fi |
|
||||
else |
|
||||
fn_logupdaterequest |
|
||||
fn_steamcmdcheck |
|
||||
fi |
|
@ -1,83 +0,0 @@ |
|||||
#!/bin/bash |
|
||||
# LGSM update_dl.sh function |
|
||||
# Author: Daniel Gibbs |
|
||||
# Website: https://gameservermanagers.com |
|
||||
lgsm_version="210516" |
|
||||
|
|
||||
# Description: Runs a server update. |
|
||||
|
|
||||
local modulename="Update" |
|
||||
function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" |
|
||||
|
|
||||
fn_steamcmd_dl(){ |
|
||||
cd "${rootdir}" |
|
||||
cd "steamcmd" |
|
||||
|
|
||||
# Detects if unbuffer command is available. |
|
||||
if [ $(command -v stdbuf) ]; then |
|
||||
unbuffer="stdbuf -i0 -o0 -e0" |
|
||||
fi |
|
||||
|
|
||||
if [ "${engine}" == "goldsource" ]; then |
|
||||
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" +quit | tee -a "${scriptlog}" |
|
||||
else |
|
||||
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit | tee -a "${scriptlog}" |
|
||||
fi |
|
||||
|
|
||||
fix.sh |
|
||||
} |
|
||||
|
|
||||
fn_teamspeak3_dl(){ |
|
||||
cd "${rootdir}" |
|
||||
echo -e "downloading teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2...\c" |
|
||||
fn_scriptlog "Downloading teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" |
|
||||
wget -N /dev/null http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2 2>&1 | grep -F HTTP | cut -c45-| uniq |
|
||||
sleep 1 |
|
||||
echo -e "extracting teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2...\c" |
|
||||
fn_scriptlog "Extracting teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" |
|
||||
tar -xf "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" 2> "${scriptlogdir}/.${servicename}-tar-error.tmp" |
|
||||
local status=$? |
|
||||
if [ ${status} -eq 0 ]; then |
|
||||
echo "OK" |
|
||||
else |
|
||||
echo "FAIL - Exit status ${status}" |
|
||||
fn_scriptlog "Failed to extract - Exit status ${status}" |
|
||||
sleep 1 |
|
||||
cat "${scriptlogdir}/.${servicename}-tar-error.tmp" |
|
||||
cat "${scriptlogdir}/.${servicename}-tar-error.tmp" >> "${scriptlog}" |
|
||||
rm "${scriptlogdir}/.${servicename}-tar-error.tmp" |
|
||||
fn_scriptlog "Failure! Unable to update" |
|
||||
exit ${status} |
|
||||
fi |
|
||||
echo -e "copying to ${filesdir}...\c" |
|
||||
fn_scriptlog "Copying to ${filesdir}" |
|
||||
cp -R "${rootdir}/teamspeak3-server_linux_${ts3arch}/"* "${filesdir}" 2> "${scriptlogdir}/.${servicename}-cp-error.tmp" |
|
||||
local status=$? |
|
||||
if [ ${status} -eq 0 ]; then |
|
||||
echo "OK" |
|
||||
else |
|
||||
echo "FAIL - Exit status ${status}" |
|
||||
fn_scriptlog "Failed to copy - Exit status ${status}" |
|
||||
sleep 1 |
|
||||
cat "${scriptlogdir}/.${servicename}-cp-error.tmp" |
|
||||
cat "${scriptlogdir}/.${servicename}-cp-error.tmp" >> "${scriptlog}" |
|
||||
rm "${scriptlogdir}/.${servicename}-cp-error.tmp" |
|
||||
fn_scriptlog "Failure! Unable to update" |
|
||||
exit ${status} |
|
||||
fi |
|
||||
rm -f teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2 |
|
||||
rm -rf "${rootdir}/teamspeak3-server_linux_${ts3arch}" |
|
||||
} |
|
||||
|
|
||||
check.sh |
|
||||
info_config.sh |
|
||||
fn_print_dots "Updating ${servername}" |
|
||||
sleep 1 |
|
||||
fn_print_ok_nl "Updating ${servername}" |
|
||||
fn_scriptlog "Updating ${servername}" |
|
||||
sleep 1 |
|
||||
if [ "${gamename}" == "Teamspeak 3" ]; then |
|
||||
fn_teamspeak3_dl |
|
||||
else |
|
||||
fn_steamcmd_dl |
|
||||
fi |
|
@ -0,0 +1,238 @@ |
|||||
|
#!/bin/bash |
||||
|
# LGSM command_update.sh function |
||||
|
# Author: Daniel Gibbs |
||||
|
# Website: https://gameservermanagers.com |
||||
|
# Description:Handles updating using steamCMD. |
||||
|
|
||||
|
local commandname="UPDATE" |
||||
|
local commandaction="Update" |
||||
|
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" |
||||
|
|
||||
|
fn_update_steamcmd_dl(){ |
||||
|
check.sh |
||||
|
info_config.sh |
||||
|
fn_print_dots "SteamCMD" |
||||
|
sleep 1 |
||||
|
fn_print_ok_nl "SteamCMD" |
||||
|
fn_script_log_info "Starting SteamCMD" |
||||
|
|
||||
|
cd "${rootdir}/steamcmd" |
||||
|
|
||||
|
# Detects if unbuffer command is available. |
||||
|
if [ $(command -v stdbuf) ]; then |
||||
|
unbuffer="stdbuf -i0 -o0 -e0" |
||||
|
fi |
||||
|
|
||||
|
if [ "${engine}" == "goldsource" ]; then |
||||
|
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" +quit | tee -a "${scriptlog}" |
||||
|
else |
||||
|
${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit | tee -a "${scriptlog}" |
||||
|
fi |
||||
|
|
||||
|
fix.sh |
||||
|
} |
||||
|
|
||||
|
fn_appmanifest_info(){ |
||||
|
appmanifestfile=$(find "${filesdir}" -type f -name "appmanifest_${appid}.acf") |
||||
|
appmanifestfilewc=$(find "${filesdir}" -type f -name "appmanifest_${appid}.acf"|wc -l) |
||||
|
} |
||||
|
|
||||
|
fn_appmanifest_check(){ |
||||
|
fn_appmanifest_info |
||||
|
# Multiple or no matching appmanifest files may sometimes be present. |
||||
|
# This error is corrected if required. |
||||
|
if [ "${appmanifestfilewc}" -ge "2" ]; then |
||||
|
sleep 1 |
||||
|
fn_print_error "Multiple appmanifest_${appid}.acf files found" |
||||
|
fn_script_log_error "Multiple appmanifest_${appid}.acf files found" |
||||
|
sleep 2 |
||||
|
fn_print_dots "Removing x${appmanifestfilewc} appmanifest_${appid}.acf files" |
||||
|
sleep 1 |
||||
|
for appfile in ${appmanifestfile}; do |
||||
|
rm "${appfile}" |
||||
|
done |
||||
|
sleep 1 |
||||
|
appmanifestfilewc1="${appmanifestfilewc}" |
||||
|
fn_appmanifest_info |
||||
|
if [ "${appmanifestfilewc}" -ge "2" ]; then |
||||
|
fn_print_fail "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files" |
||||
|
fn_script_log_fatal "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files" |
||||
|
sleep 1 |
||||
|
echo " * Check user permissions" |
||||
|
for appfile in ${appmanifestfile}; do |
||||
|
echo " ${appfile}" |
||||
|
done |
||||
|
core_exit.sh |
||||
|
else |
||||
|
fn_print_ok "Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files" |
||||
|
fn_script_log_pass "Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files" |
||||
|
sleep 1 |
||||
|
fn_print_info_nl "Forcing update to correct issue" |
||||
|
fn_script_log_info "Forcing update to correct issue" |
||||
|
sleep 1 |
||||
|
fn_update_steamcmd_dl |
||||
|
fn_update_request_log |
||||
|
fi |
||||
|
elif [ "${appmanifestfilewc}" -eq "0" ]; then |
||||
|
fn_print_error "No appmanifest_${appid}.acf found" |
||||
|
fn_script_log_error "No appmanifest_${appid}.acf found" |
||||
|
sleep 1 |
||||
|
fn_print_info_nl "Forcing update to correct issue" |
||||
|
fn_script_log_info "Forcing update to correct issue" |
||||
|
sleep 1 |
||||
|
fn_update_steamcmd_dl |
||||
|
fn_update_request_log |
||||
|
fn_appmanifest_info |
||||
|
if [ "${appmanifestfilewc}" -eq "0" ]; then |
||||
|
fn_print_fatal "Still no appmanifest_${appid}.acf found" |
||||
|
fn_script_log_fatal "Still no appmanifest_${appid}.acf found" |
||||
|
core_exit.sh |
||||
|
fi |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
fn_update_request_log(){ |
||||
|
# Checks for server update requests from server logs. |
||||
|
fn_print_dots "Checking for update: Server logs" |
||||
|
fn_script_log_info "Checking for update: Server logs" |
||||
|
sleep 1 |
||||
|
requestrestart=$(grep -Ec "MasterRequestRestart" "${consolelog}") |
||||
|
if [ "${requestrestart}" -ge "1" ]; then |
||||
|
fn_print_ok_nl "Checking for update: Server logs: Update requested" |
||||
|
fn_script_log_pass "Checking for update: Server logs: Update requested" |
||||
|
sleep 1 |
||||
|
echo "" |
||||
|
echo -en "Applying update.\r" |
||||
|
sleep 1 |
||||
|
echo -en "Applying update..\r" |
||||
|
sleep 1 |
||||
|
echo -en "Applying update...\r" |
||||
|
sleep 1 |
||||
|
echo -en "\n" |
||||
|
|
||||
|
unset updateonstart |
||||
|
check_status.sh |
||||
|
if [ "${status}" != "0" ]; then |
||||
|
exitbypass=1 |
||||
|
command_stop.sh |
||||
|
fn_update_steamcmd_dl |
||||
|
exitbypass=1 |
||||
|
command_start.sh |
||||
|
else |
||||
|
fn_update_steamcmd_dl |
||||
|
fi |
||||
|
alert="update" |
||||
|
alert.sh |
||||
|
else |
||||
|
fn_print_ok "Checking for update: Server logs: No update requested" |
||||
|
sleep 1 |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
fn_update_steamcmd_check(){ |
||||
|
fn_appmanifest_check |
||||
|
# Checks for server update from SteamCMD |
||||
|
fn_print_dots "Checking for update: SteamCMD" |
||||
|
fn_script_log_info "Checking for update: SteamCMD" |
||||
|
sleep 1 |
||||
|
|
||||
|
# Gets currentbuild |
||||
|
currentbuild=$(grep buildid "${appmanifestfile}" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3) |
||||
|
|
||||
|
# Removes appinfo.vdf as a fix for not always getting up to date version info from SteamCMD |
||||
|
cd "${rootdir}/steamcmd" |
||||
|
if [ -f "${HOME}/Steam/appcache/appinfo.vdf" ]; then |
||||
|
rm -f "${HOME}/Steam/appcache/appinfo.vdf" |
||||
|
fi |
||||
|
|
||||
|
# Set branch for updateinfo |
||||
|
IFS=' ' read -a branchsplits <<< "${branch}" |
||||
|
if [ "${#branchsplits[@]}" -gt 1 ]; then |
||||
|
branchname="${branchsplits[1]}" |
||||
|
else |
||||
|
branchname="public" |
||||
|
fi |
||||
|
|
||||
|
# Gets availablebuild info |
||||
|
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+\"${branchname}\"$" | grep -m 1 -EB 10 "^\s+}$" | grep -E "^\s+\"buildid\"\s+" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3) |
||||
|
if [ -z "${availablebuild}" ]; then |
||||
|
fn_print_fail "Checking for update: SteamCMD" |
||||
|
sleep 1 |
||||
|
fn_print_fail_nl "Checking for update: SteamCMD: Not returning version info" |
||||
|
fn_script_log_fatal "Checking for update: SteamCMD: Not returning version info" |
||||
|
core_exit.sh |
||||
|
else |
||||
|
fn_print_ok "Checking for update: SteamCMD" |
||||
|
fn_script_log_pass "Checking for update: SteamCMD" |
||||
|
sleep 1 |
||||
|
fi |
||||
|
|
||||
|
if [ "${currentbuild}" != "${availablebuild}" ]; then |
||||
|
fn_print_ok "Checking for update: SteamCMD: Update available" |
||||
|
fn_script_log_pass "Checking for update: SteamCMD: Update available" |
||||
|
echo -e "\n" |
||||
|
echo -e "Update available:" |
||||
|
sleep 1 |
||||
|
echo -e " Current build: ${red}${currentbuild}${default}" |
||||
|
echo -e " Available build: ${green}${availablebuild}${default}" |
||||
|
echo -e "" |
||||
|
echo -e " https://steamdb.info/app/${appid}/" |
||||
|
sleep 1 |
||||
|
echo "" |
||||
|
echo -en "Applying update.\r" |
||||
|
sleep 1 |
||||
|
echo -en "Applying update..\r" |
||||
|
sleep 1 |
||||
|
echo -en "Applying update...\r" |
||||
|
sleep 1 |
||||
|
echo -en "\n" |
||||
|
fn_script_log_info "Update available" |
||||
|
fn_script_log_info "Current build: ${currentbuild}" |
||||
|
fn_script_log_info "Available build: ${availablebuild}" |
||||
|
fn_script_log_info "${currentbuild} > ${availablebuild}" |
||||
|
|
||||
|
unset updateonstart |
||||
|
check_status.sh |
||||
|
if [ "${status}" != "0" ]; then |
||||
|
exitbypass=1 |
||||
|
command_stop.sh |
||||
|
fn_update_steamcmd_dl |
||||
|
exitbypass=1 |
||||
|
command_start.sh |
||||
|
else |
||||
|
fn_update_steamcmd_dl |
||||
|
fi |
||||
|
alert="update" |
||||
|
alert.sh |
||||
|
else |
||||
|
fn_print_ok "Checking for update: SteamCMD: No update available" |
||||
|
fn_script_log_pass "Checking for update: SteamCMD: No update available" |
||||
|
echo -e "\n" |
||||
|
echo -e "No update available:" |
||||
|
echo -e " Current version: ${green}${currentbuild}${default}" |
||||
|
echo -e " Available version: ${green}${availablebuild}${default}" |
||||
|
echo -e " https://steamdb.info/app/${appid}/" |
||||
|
echo -e "" |
||||
|
fn_script_log_info "Current build: ${currentbuild}" |
||||
|
fn_script_log_info "Available build: ${availablebuild}" |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
|
||||
|
if [ "${engine}" == "goldsource" ]||[ "${forceupdate}" == "1" ]; then |
||||
|
# Goldsource servers bypass checks as fn_update_steamcmd_check does not work for appid 90 servers. |
||||
|
# forceupdate bypasses checks |
||||
|
check_status.sh |
||||
|
if [ "${status}" != "0" ]; then |
||||
|
exitbypass=1 |
||||
|
command_stop.sh |
||||
|
fn_update_steamcmd_dl |
||||
|
exitbypass=1 |
||||
|
command_start.sh |
||||
|
else |
||||
|
fn_update_steamcmd_dl |
||||
|
fi |
||||
|
else |
||||
|
fn_update_request_log |
||||
|
fn_update_steamcmd_check |
||||
|
fi |
@ -0,0 +1,182 @@ |
|||||
|
#!/bin/bash |
||||
|
# LGSM command_update.sh function |
||||
|
# Author: Daniel Gibbs |
||||
|
# Website: https://gameservermanagers.com |
||||
|
# Description:Handles updating of teamspeak 3 servers. |
||||
|
|
||||
|
local commandname="UPDATE" |
||||
|
local commandaction="Update" |
||||
|
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" |
||||
|
|
||||
|
fn_update_ts3_dl(){ |
||||
|
fn_fetch_file "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" "${lgsmdir}/tmp" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" |
||||
|
fn_dl_extract "${lgsmdir}/tmp" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" "${lgsmdir}/tmp" |
||||
|
echo -e "copying to ${filesdir}...\c" |
||||
|
fn_script_log "Copying to ${filesdir}" |
||||
|
cp -R "${lgsmdir}/tmp/teamspeak3-server_linux_${ts3arch}/"* "${filesdir}" |
||||
|
local exitcode=$? |
||||
|
if [ ${exitcode} -eq 0 ]; then |
||||
|
fn_print_ok_eol_nl |
||||
|
else |
||||
|
fn_print_fail_eol_nl |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
fn_update_ts3_currentbuild(){ |
||||
|
# 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_print_error "Checking for update: teamspeak.com" |
||||
|
sleep 1 |
||||
|
fn_print_error_nl "Checking for update: teamspeak.com: No logs with server version found" |
||||
|
fn_script_log_error "Checking for update: teamspeak.com: No logs with server version found" |
||||
|
sleep 2 |
||||
|
fn_print_info_nl "Checking for update: teamspeak.com: Forcing server restart" |
||||
|
fn_script_log_info "Checking for update: teamspeak.com: Forcing server restart" |
||||
|
sleep 2 |
||||
|
exitbypass=1 |
||||
|
command_stop.sh |
||||
|
exitbypass=1 |
||||
|
command_start.sh |
||||
|
sleep 1 |
||||
|
# Check again and exit on failure. |
||||
|
if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then |
||||
|
fn_print_fail_nl "Checking for update: teamspeak.com: Still No logs with server version found" |
||||
|
fn_script_log_fatal "Checking for update: teamspeak.com: Still No logs with server version found" |
||||
|
core_exit.sh |
||||
|
fi |
||||
|
fi |
||||
|
|
||||
|
currentbuild=$(cat $(find ./* -name 'ts3server*_0.log' 2> /dev/null | sort | egrep -E -v '${rootdir}/.ts3version' | tail -1) | egrep -o 'TeamSpeak 3 Server ((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}' | egrep -o '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}') |
||||
|
} |
||||
|
|
||||
|
fn_update_ts3_arch(){ |
||||
|
# Gets the teamspeak server architecture. |
||||
|
info_distro.sh |
||||
|
if [ "${arch}" == "x86_64" ]; then |
||||
|
ts3arch="amd64" |
||||
|
elif [ "${arch}" == "i386" ]||[ "${arch}" == "i686" ]; then |
||||
|
ts3arch="x86" |
||||
|
else |
||||
|
echo "" |
||||
|
fn_print_failure "unknown or unsupported architecture: ${arch}" |
||||
|
fn_script_log_fatal "unknown or unsupported architecture: ${arch}" |
||||
|
core_exit.sh |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
fn_update_ts3_availablebuild(){ |
||||
|
# Gets availablebuild info. |
||||
|
|
||||
|
# Creates tmp dir if missing |
||||
|
if [ ! -d "${lgsmdir}/tmp" ]; then |
||||
|
mkdir -p "${lgsmdir}/tmp" |
||||
|
fi |
||||
|
|
||||
|
# Grabs all version numbers but not in correct order. |
||||
|
wget "http://dl.4players.de/ts/releases/?C=M;O=D" -q -O -| grep -i dir | egrep -o '<a href=\".*\/\">.*\/<\/a>' | egrep -o '[0-9\.?]+'|uniq > "${lgsmdir}/tmp/.ts3_version_numbers_unsorted.tmp" |
||||
|
|
||||
|
# Sort version numbers |
||||
|
cat "${lgsmdir}/tmp/.ts3_version_numbers_unsorted.tmp" | sort -r --version-sort -o "${lgsmdir}/tmp/.ts3_version_numbers_sorted.tmp" |
||||
|
|
||||
|
# Finds directory with most recent server version. |
||||
|
while read ts3_version_number; do |
||||
|
wget --spider -q "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" |
||||
|
if [ $? -eq 0 ]; then |
||||
|
availablebuild="${ts3_version_number}" |
||||
|
# Break while-loop, if the latest release could be found. |
||||
|
break |
||||
|
fi |
||||
|
done < "${lgsmdir}/tmp/.ts3_version_numbers_sorted.tmp" |
||||
|
|
||||
|
# Tidy up |
||||
|
rm -f "${lgsmdir}/tmp/.ts3_version_numbers_unsorted.tmp" |
||||
|
rm -f "${lgsmdir}/tmp/.ts3_version_numbers_sorted.tmp" |
||||
|
|
||||
|
# Checks availablebuild info is available |
||||
|
if [ -z "${availablebuild}" ]; then |
||||
|
fn_print_fail "Checking for update: teamspeak.com" |
||||
|
sleep 1 |
||||
|
fn_print_fail "Checking for update: teamspeak.com: Not returning version info" |
||||
|
fn_script_log_fatal "Failure! Checking for update: teamspeak.com: Not returning version info" |
||||
|
core_exit.sh |
||||
|
else |
||||
|
fn_print_ok_nl "Checking for update: teamspeak.com" |
||||
|
fn_script_log_pass "Checking for update: teamspeak.com" |
||||
|
sleep 1 |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
fn_update_ts3_compare(){ |
||||
|
# Removes dots so if can compare version numbers |
||||
|
currentbuilddigit=$(echo "${currentbuild}"|tr -cd '[:digit:]') |
||||
|
availablebuilddigit=$(echo "${availablebuild}"|tr -cd '[:digit:]') |
||||
|
|
||||
|
if [ "${currentbuilddigit}" -ne "${availablebuilddigit}" ]; then |
||||
|
echo -e "\n" |
||||
|
echo -e "Update available:" |
||||
|
sleep 1 |
||||
|
echo -e " Current build: ${red}${currentbuild} ${architecture}${default}" |
||||
|
echo -e " Available build: ${green}${availablebuild} ${architecture}${default}" |
||||
|
echo -e "" |
||||
|
sleep 1 |
||||
|
echo "" |
||||
|
echo -en "Applying update.\r" |
||||
|
sleep 1 |
||||
|
echo -en "Applying update..\r" |
||||
|
sleep 1 |
||||
|
echo -en "Applying update...\r" |
||||
|
sleep 1 |
||||
|
echo -en "\n" |
||||
|
fn_script_log "Update available" |
||||
|
fn_script_log "Current build: ${currentbuild}" |
||||
|
fn_script_log "Available build: ${availablebuild}" |
||||
|
fn_script_log "${currentbuild} > ${availablebuild}" |
||||
|
|
||||
|
unset updateonstart |
||||
|
|
||||
|
check_status.sh |
||||
|
if [ "${status}" == "0" ]; then |
||||
|
fn_update_ts3_dl |
||||
|
exitbypass=1 |
||||
|
command_start.sh |
||||
|
exitbypass=1 |
||||
|
command_stop.sh |
||||
|
else |
||||
|
exitbypass=1 |
||||
|
command_stop.sh |
||||
|
fn_update_ts3_dl |
||||
|
exitbypass=1 |
||||
|
command_start.sh |
||||
|
fi |
||||
|
alert="update" |
||||
|
alert.sh |
||||
|
else |
||||
|
echo -e "\n" |
||||
|
echo -e "No update available:" |
||||
|
echo -e " Current version: ${green}${currentbuild}${default}" |
||||
|
echo -e " Available version: ${green}${availablebuild}${default}" |
||||
|
echo -e "" |
||||
|
fn_print_ok_nl "No update available" |
||||
|
fn_script_log_info "Current build: ${currentbuild}" |
||||
|
fn_script_log_info "Available build: ${availablebuild}" |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
|
||||
|
fn_update_ts3_arch |
||||
|
if [ "${installer}" == "1" ]; then |
||||
|
fn_update_ts3_availablebuild |
||||
|
fn_update_ts3_dl |
||||
|
else |
||||
|
# Checks for server update from teamspeak.com using a mirror dl.4players.de. |
||||
|
fn_print_dots "Checking for update: teamspeak.com" |
||||
|
fn_script_log_info "Checking for update: teamspeak.com" |
||||
|
sleep 1 |
||||
|
fn_update_ts3_currentbuild |
||||
|
fn_update_ts3_availablebuild |
||||
|
fn_update_ts3_compare |
||||
|
fi |
@ -1,16 +1,29 @@ |
|||||
#!/bin/bash |
#!/bin/bash |
||||
# TravisCI Tests |
# TravisCI Tests: Just Cause 2 |
||||
# Server Management Script |
# Server Management Script |
||||
# Author: Daniel Gibbs |
# Author: Daniel Gibbs |
||||
# Website: https://gameservermanagers.com |
# Website: https://gameservermanagers.com |
||||
version="271215" |
version="101716" |
||||
|
|
||||
|
if [ -f ".dev-debug" ]; then |
||||
|
exec 5>dev-debug.log |
||||
|
BASH_XTRACEFD="5" |
||||
|
set -x |
||||
|
fi |
||||
|
|
||||
#### Variables #### |
#### Variables #### |
||||
|
|
||||
# Alert Email |
# Notification Alerts |
||||
# (on|off) |
# (on|off) |
||||
|
|
||||
|
# Email |
||||
emailalert="off" |
emailalert="off" |
||||
email="" |
email="[email protected]" |
||||
|
|
||||
|
# Pushbullet |
||||
|
# https://www.pushbullet.com/#settings |
||||
|
pushbulletalert="off" |
||||
|
pushbullettoken="accesstoken" |
||||
|
|
||||
# Steam login |
# Steam login |
||||
steamuser="anonymous" |
steamuser="anonymous" |
||||
@ -44,6 +57,9 @@ engine="avalanche" |
|||||
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))" |
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))" |
||||
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" |
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" |
||||
lockselfname=".${servicename}.lock" |
lockselfname=".${servicename}.lock" |
||||
|
lgsmdir="${rootdir}/lgsm" |
||||
|
functionsdir="${lgsmdir}/functions" |
||||
|
libdir="${lgsmdir}/lib" |
||||
filesdir="${rootdir}/serverfiles" |
filesdir="${rootdir}/serverfiles" |
||||
systemdir="${filesdir}" |
systemdir="${filesdir}" |
||||
executabledir="${filesdir}" |
executabledir="${filesdir}" |
||||
@ -59,6 +75,7 @@ logdays="7" |
|||||
#gamelogdir="" # No server logs available |
#gamelogdir="" # No server logs available |
||||
scriptlogdir="${rootdir}/log/script" |
scriptlogdir="${rootdir}/log/script" |
||||
consolelogdir="${rootdir}/log/console" |
consolelogdir="${rootdir}/log/console" |
||||
|
consolelogging="on" |
||||
|
|
||||
scriptlog="${scriptlogdir}/${servicename}-script.log" |
scriptlog="${scriptlogdir}/${servicename}-script.log" |
||||
consolelog="${consolelogdir}/${servicename}-console.log" |
consolelog="${consolelogdir}/${servicename}-console.log" |
||||
@ -70,74 +87,80 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M- |
|||||
##### Script ##### |
##### Script ##### |
||||
# Do not edit |
# Do not edit |
||||
|
|
||||
fn_getgithubfile(){ |
# Fetches core_dl for file downloads |
||||
filename=$1 |
fn_fetch_core_dl(){ |
||||
exec=$2 |
github_file_url_dir="lgsm/functions" |
||||
fileurl=${3:-$filename} |
github_file_url_name="${functionfile}" |
||||
filepath="${rootdir}/${filename}" |
filedir="${functionsdir}" |
||||
filedir=$(dirname "${filepath}") |
filename="${github_file_url_name}" |
||||
# If the function file is missing, then download |
githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" |
||||
if [ ! -f "${filepath}" ]; then |
# If the file is missing, then download |
||||
|
if [ ! -f "${filedir}/${filename}" ]; then |
||||
if [ ! -d "${filedir}" ]; then |
if [ ! -d "${filedir}" ]; then |
||||
mkdir "${filedir}" |
mkdir -p "${filedir}" |
||||
fi |
fi |
||||
githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}" |
|
||||
echo -e " fetching ${filename}...\c" |
echo -e " fetching ${filename}...\c" |
||||
if [ "$(command -v curl)" ]||[ "$(which curl >/dev/null 2>&1)" ]||[ -f "/usr/bin/curl" ]||[ -f "/bin/curl" ]; then |
# Check curl exists and use available path |
||||
: |
curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)" |
||||
|
for curlcmd in ${curlpaths} |
||||
|
do |
||||
|
if [ -x "${curlcmd}" ]; then |
||||
|
break |
||||
|
fi |
||||
|
done |
||||
|
# If curl exists download file |
||||
|
if [ "$(basename ${curlcmd})" == "curl" ]; then |
||||
|
curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1) |
||||
|
if [ $? -ne 0 ]; then |
||||
|
echo -e "\e[0;31mFAIL\e[0m\n" |
||||
|
echo "${curlfetch}" |
||||
|
echo -e "${githuburl}\n" |
||||
|
exit 1 |
||||
|
else |
||||
|
echo -e "\e[0;32mOK\e[0m" |
||||
|
fi |
||||
else |
else |
||||
echo -e "\e[0;31mFAIL\e[0m\n" |
echo -e "\e[0;31mFAIL\e[0m\n" |
||||
echo "Curl is not installed!" |
echo "Curl is not installed!" |
||||
echo -e "" |
echo -e "" |
||||
exit |
exit 1 |
||||
fi |
|
||||
curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1) |
|
||||
if [ $? -ne 0 ]; then |
|
||||
echo -e "\e[0;31mFAIL\e[0m\n" |
|
||||
echo "${curl}" |
|
||||
echo -e "${githuburl}\n" |
|
||||
exit |
|
||||
else |
|
||||
echo -e "\e[0;32mOK\e[0m" |
|
||||
fi |
|
||||
if [ "${exec}" ]; then |
|
||||
chmod +x "${filepath}" |
|
||||
fi |
fi |
||||
|
chmod +x "${filedir}/${filename}" |
||||
fi |
fi |
||||
if [ "${exec}" ]; then |
source "${filedir}/${filename}" |
||||
source "${filepath}" |
|
||||
fi |
|
||||
} |
} |
||||
|
|
||||
fn_runfunction(){ |
core_dl.sh(){ |
||||
fn_getgithubfile "functions/${functionfile}" 1 |
# Functions are defined in core_functions.sh. |
||||
|
functionfile="${FUNCNAME}" |
||||
|
fn_fetch_core_dl |
||||
} |
} |
||||
|
|
||||
core_functions.sh(){ |
core_functions.sh(){ |
||||
# Functions are defined in core_functions.sh. |
# Functions are defined in core_functions.sh. |
||||
functionfile="${FUNCNAME}" |
functionfile="${FUNCNAME}" |
||||
fn_runfunction |
fn_fetch_core_dl |
||||
} |
} |
||||
|
|
||||
|
core_dl.sh |
||||
core_functions.sh |
core_functions.sh |
||||
|
|
||||
fn_currentstatus_tmux(){ |
fn_currentstatus_tmux(){ |
||||
pid=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:") |
check_status.sh |
||||
if [ "${pid}" != "0" ]; then |
if [ "${status}" != "0" ]; then |
||||
currentstatus="ONLINE" |
currentstatus="ONLINE" |
||||
else |
else |
||||
currentstatus="OFFLINE" |
currentstatus="OFFLINE" |
||||
fi |
fi |
||||
} |
} |
||||
|
|
||||
fn_currentstatus_ts3(){ |
fn_currentstatus_ts3(){ |
||||
ts3status=$(${executable} status servercfgfullpathfile=${servercfgfullpath}) |
check_status.sh |
||||
|
if [ "${status}" != "0" ]; then |
||||
if [ "${ts3status}" == "Server is running" ]; then |
currentstatus="ONLINE" |
||||
currentstatus="ONLINE" |
else |
||||
else |
currentstatus="OFFLINE" |
||||
currentstatus="OFFLINE" |
fi |
||||
fi |
|
||||
} |
} |
||||
|
|
||||
fn_setstatus(){ |
fn_setstatus(){ |
||||
@ -146,9 +169,9 @@ fn_setstatus(){ |
|||||
echo "Required status: ${requiredstatus}" |
echo "Required status: ${requiredstatus}" |
||||
counter=0 |
counter=0 |
||||
echo "Current status: ${currentstatus}" |
echo "Current status: ${currentstatus}" |
||||
while [ "${requiredstatus}" != "${currentstatus}" ]; do |
while [ "${requiredstatus}" != "${currentstatus}" ]; do |
||||
counter=$((counter+1)) |
counter=$((counter+1)) |
||||
fn_currentstatus_tmux |
fn_currentstatus_tmux |
||||
echo -ne "New status: ${currentstatus}\\r" |
echo -ne "New status: ${currentstatus}\\r" |
||||
|
|
||||
if [ "${requiredstatus}" == "ONLINE" ]; then |
if [ "${requiredstatus}" == "ONLINE" ]; then |
||||
@ -171,6 +194,44 @@ fn_setstatus(){ |
|||||
sleep 0.5 |
sleep 0.5 |
||||
} |
} |
||||
|
|
||||
|
# End of every test will expect the result to either pass or fail |
||||
|
# If the script does not do as intended the whole test will fail |
||||
|
# if excpecting a pass |
||||
|
fn_test_result_pass(){ |
||||
|
if [ $? != 0 ]; then |
||||
|
echo "=================================" |
||||
|
echo "Expected result: PASS" |
||||
|
echo "Actual result: FAIL" |
||||
|
fn_print_fail_nl "TEST FAILED" |
||||
|
exitcode=1 |
||||
|
core_exit.sh |
||||
|
else |
||||
|
echo "=================================" |
||||
|
echo "Expected result: PASS" |
||||
|
echo "Actual result: PASS" |
||||
|
fn_print_ok_nl "TEST PASSED" |
||||
|
echo "" |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
# if excpecting a fail |
||||
|
fn_test_result_fail(){ |
||||
|
if [ $? == 0 ]; then |
||||
|
echo "=================================" |
||||
|
echo "Expected result: FAIL" |
||||
|
echo "Actual result: PASS" |
||||
|
fn_print_fail_nl "TEST FAILED" |
||||
|
exitcode=1 |
||||
|
core_exit.sh |
||||
|
else |
||||
|
echo "=================================" |
||||
|
echo "Expected result: FAIL" |
||||
|
echo "Actual result: FAIL" |
||||
|
fn_print_ok_nl "TEST PASSED" |
||||
|
echo "" |
||||
|
fi |
||||
|
} |
||||
|
|
||||
echo "=================================" |
echo "=================================" |
||||
echo "TravisCI Tests" |
echo "TravisCI Tests" |
||||
echo "Linux Game Server Manager" |
echo "Linux Game Server Manager" |
||||
@ -178,308 +239,313 @@ echo "by Daniel Gibbs" |
|||||
echo "https://gameservermanagers.com" |
echo "https://gameservermanagers.com" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "" |
echo "" |
||||
sleep 1 |
|
||||
echo "=================================" |
echo "=================================" |
||||
echo "Server Tests" |
echo "Server Tests" |
||||
echo "Using: ${gamename}" |
echo "Using: ${gamename}" |
||||
echo "Testing Branch: $TRAVIS_BRANCH" |
echo "Testing Branch: $TRAVIS_BRANCH" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "" |
echo "" |
||||
sleep 1 |
|
||||
mkdir ${rootdir} |
|
||||
|
|
||||
|
echo "0.1 - Create log dir's" |
||||
|
echo "=================================" |
||||
|
echo "Description:" |
||||
|
echo "Create log dir's" |
||||
|
echo "" |
||||
|
(install_logs.sh) |
||||
|
|
||||
|
|
||||
|
echo "0.2 - Enable dev-debug" |
||||
|
echo "=================================" |
||||
|
echo "Description:" |
||||
|
echo "Enable dev-debug" |
||||
|
echo "" |
||||
|
(command_dev_debug.sh) |
||||
|
fn_test_result_pass |
||||
|
|
||||
echo "1.0 - start - no files" |
echo "1.0 - start - no files" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "test script reaction to missing server files." |
echo "test script reaction to missing server files." |
||||
|
echo "Command: ./jc2server start" |
||||
echo "" |
echo "" |
||||
(command_start.sh) |
(command_start.sh) |
||||
echo "" |
fn_test_result_fail |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "1.1 - getopt" |
echo "1.1 - getopt" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "displaying options messages." |
echo "displaying options messages." |
||||
|
echo "Command: ./jc2server" |
||||
echo "" |
echo "" |
||||
(core_getopt.sh) |
(core_getopt.sh) |
||||
|
fn_test_result_pass |
||||
|
|
||||
echo "" |
echo "" |
||||
echo "Test complete!" |
echo "1.2 - getopt with incorrect args" |
||||
sleep 1 |
echo "=================================" |
||||
|
echo "Description:" |
||||
|
echo "displaying options messages." |
||||
|
echo "Command: ./jc2server abc123" |
||||
echo "" |
echo "" |
||||
|
getopt="abc123" |
||||
|
(core_getopt.sh) |
||||
|
fn_test_result_fail |
||||
|
|
||||
|
echo "" |
||||
|
|
||||
echo "2.0 - install" |
echo "2.0 - install" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "install ${gamename} server." |
echo "install ${gamename} server." |
||||
fn_autoinstall |
echo "Command: ./jc2server auto-install" |
||||
echo "" |
(fn_autoinstall) |
||||
echo "Test complete!" |
fn_test_result_pass |
||||
sleep 1 |
|
||||
echo "" |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
echo "" |
||||
echo "3.1 - start" |
echo "3.1 - start" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "start ${gamename} server." |
echo "start ${gamename} server." |
||||
|
echo "Command: ./jc2server start" |
||||
requiredstatus="OFFLINE" |
requiredstatus="OFFLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
command_start.sh |
(command_start.sh) |
||||
echo "" |
fn_test_result_pass |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "3.2 - start - online" |
echo "3.2 - start - online" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "start ${gamename} server while already running." |
echo "start ${gamename} server while already running." |
||||
|
echo "Command: ./jc2server start" |
||||
requiredstatus="ONLINE" |
requiredstatus="ONLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
(command_start.sh) |
(command_start.sh) |
||||
echo "" |
fn_test_result_fail |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "3.3 - start - updateonstart" |
echo "3.3 - start - updateonstart" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "will update server on start." |
echo "will update server on start." |
||||
|
echo "Command: ./jc2server start" |
||||
requiredstatus="OFFLINE" |
requiredstatus="OFFLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
( |
(updateonstart="on";command_start.sh) |
||||
updateonstart="on" |
fn_test_result_pass |
||||
command_start.sh |
|
||||
) |
|
||||
echo "" |
|
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "3.4 - stop" |
echo "3.4 - stop" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "stop ${gamename} server." |
echo "stop ${gamename} server." |
||||
|
echo "Command: ./jc2server stop" |
||||
requiredstatus="ONLINE" |
requiredstatus="ONLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
command_stop.sh |
(command_stop.sh) |
||||
echo "" |
fn_test_result_pass |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "3.5 - stop - offline" |
echo "3.5 - stop - offline" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "stop ${gamename} server while already stopped." |
echo "stop ${gamename} server while already stopped." |
||||
|
echo "Command: ./jc2server stop" |
||||
requiredstatus="OFFLINE" |
requiredstatus="OFFLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
(command_stop.sh) |
(command_stop.sh) |
||||
echo "" |
fn_test_result_fail |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "3.6 - restart" |
echo "3.6 - restart" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "restart ${gamename}." |
echo "restart ${gamename}." |
||||
|
echo "Command: ./jc2server restart" |
||||
requiredstatus="ONLINE" |
requiredstatus="ONLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
fn_restart |
(command_restart.sh) |
||||
echo "" |
fn_test_result_pass |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "3.7 - restart - offline" |
echo "3.7 - restart - offline" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "restart ${gamename} while already stopped." |
echo "restart ${gamename} while already stopped." |
||||
|
echo "Command: ./jc2server restart" |
||||
requiredstatus="OFFLINE" |
requiredstatus="OFFLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
fn_restart |
(command_restart.sh) |
||||
echo "" |
fn_test_result_pass |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
|
||||
|
|
||||
|
|
||||
|
|
||||
echo "4.1 - update" |
echo "4.1 - update" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "check for updates." |
echo "check for updates." |
||||
|
echo "Command: ./jc2server update" |
||||
requiredstatus="OFFLINE" |
requiredstatus="OFFLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
update_check.sh |
(command_update.sh) |
||||
echo "" |
fn_test_result_pass |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "4.2 - update - change buildid" |
echo "4.2 - update - change buildid" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "change the buildid tricking SteamCMD to update." |
echo "change the buildid tricking SteamCMD to update." |
||||
|
echo "Command: ./jc2server update" |
||||
requiredstatus="OFFLINE" |
requiredstatus="OFFLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
fn_print_info_nl "changed buildid to 0." |
fn_print_info_nl "changed buildid to 0." |
||||
sed -i 's/[0-9]\+/0/' ${filesdir}/steamapps/appmanifest_${appid}.acf |
sed -i 's/[0-9]\+/0/' "${filesdir}/steamapps/appmanifest_${appid}.acf" |
||||
update_check.sh |
(command_update.sh) |
||||
echo "" |
fn_test_result_pass |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "4.3 - update - change buildid - online" |
echo "4.3 - update - change buildid - online" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "change the buildid tricking SteamCMD to update server while already running." |
echo "change the buildid tricking SteamCMD to update server while already running." |
||||
|
echo "Command: ./jc2server update" |
||||
requiredstatus="ONLINE" |
requiredstatus="ONLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
fn_print_info_nl "changed buildid to 0." |
fn_print_info_nl "changed buildid to 0." |
||||
sed -i 's/[0-9]\+/0/' ${filesdir}/steamapps/appmanifest_${appid}.acf |
sed -i 's/[0-9]\+/0/' "${filesdir}/steamapps/appmanifest_${appid}.acf" |
||||
update_check.sh |
(command_update.sh) |
||||
echo "" |
fn_test_result_pass |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "4.4 - update - remove appmanifest file" |
echo "4.4 - update - remove appmanifest file" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "removing appmanifest file will cause script to repair." |
echo "removing appmanifest file will cause script to repair." |
||||
|
echo "Command: ./jc2server update" |
||||
requiredstatus="OFFLINE" |
requiredstatus="OFFLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
fn_print_info_nl "removed appmanifest_${appid}.acf." |
fn_print_info_nl "removed appmanifest_${appid}.acf." |
||||
rm --verbose "${filesdir}/steamapps/appmanifest_${appid}.acf" |
rm --verbose "${filesdir}/steamapps/appmanifest_${appid}.acf" |
||||
update_check.sh |
(command_update.sh) |
||||
echo "" |
fn_test_result_pass |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "4.5 - force-update" |
echo "4.5 - force-update" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "force-update bypassing update check." |
echo "force-update bypassing update check." |
||||
|
echo "Command: ./jc2server force-update" |
||||
requiredstatus="OFFLINE" |
requiredstatus="OFFLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
update_check.sh |
(forceupdate=1;command_update.sh) |
||||
echo "" |
fn_test_result_pass |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "4.6 - force-update - online" |
echo "4.6 - force-update - online" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "force-update bypassing update check server while already running." |
echo "force-update bypassing update check server while already running." |
||||
|
echo "Command: ./jc2server force-update" |
||||
requiredstatus="ONLINE" |
requiredstatus="ONLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
update_check.sh |
(forceupdate=1;command_update.sh) |
||||
echo "" |
fn_test_result_pass |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "4.7 - validate" |
echo "4.7 - validate" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "validate server files." |
echo "validate server files." |
||||
|
echo "Command: ./jc2server validate" |
||||
requiredstatus="OFFLINE" |
requiredstatus="OFFLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
command_validate.sh |
(command_validate.sh) |
||||
echo "" |
fn_test_result_pass |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "4.8 - validate - online" |
echo "4.8 - validate - online" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "validate server files while server while already running." |
echo "validate server files while server while already running." |
||||
|
echo "" |
||||
|
echo "Command: ./jc2server validate" |
||||
requiredstatus="ONLINE" |
requiredstatus="ONLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
command_validate.sh |
(command_validate.sh) |
||||
echo "" |
fn_test_result_pass |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
echo "" |
||||
echo "5.1 - monitor - online" |
echo "5.1 - monitor - online" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "run monitor server while already running." |
echo "run monitor server while already running." |
||||
|
echo "Command: ./jc2server monitor" |
||||
requiredstatus="ONLINE" |
requiredstatus="ONLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
(command_monitor.sh) |
(command_monitor.sh) |
||||
|
fn_test_result_pass |
||||
|
|
||||
|
|
||||
echo "" |
echo "" |
||||
echo "Test complete!" |
echo "5.2 - monitor - offline - with lockfile" |
||||
sleep 1 |
|
||||
echo "" |
|
||||
echo "5.2 - monitor - offline - no lockfile" |
|
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "run monitor while server is offline with no lockfile." |
echo "run monitor while server is offline with lockfile." |
||||
|
echo "Command: ./jc2server monitor" |
||||
requiredstatus="OFFLINE" |
requiredstatus="OFFLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
|
fn_print_info_nl "creating lockfile." |
||||
|
date > "${rootdir}/${lockselfname}" |
||||
(command_monitor.sh) |
(command_monitor.sh) |
||||
|
fn_test_result_pass |
||||
|
|
||||
|
|
||||
echo "" |
echo "" |
||||
echo "Test complete!" |
echo "5.3 - monitor - offline - no lockfile" |
||||
sleep 1 |
|
||||
echo "" |
|
||||
echo "5.3 - monitor - offline - with lockfile" |
|
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "run monitor while server is offline with no lockfile." |
echo "run monitor while server is offline with no lockfile." |
||||
|
echo "Command: ./jc2server monitor" |
||||
requiredstatus="OFFLINE" |
requiredstatus="OFFLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
fn_print_info_nl "creating lockfile." |
|
||||
date > "${rootdir}/${lockselfname}" |
|
||||
(command_monitor.sh) |
(command_monitor.sh) |
||||
echo "" |
fn_test_result_fail |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "5.4 - monitor - gsquery.py failure" |
echo "5.4 - monitor - gsquery.py failure" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "gsquery.py will fail to query port." |
echo "gsquery.py will fail to query port." |
||||
|
echo "Command: ./jc2server monitor" |
||||
requiredstatus="ONLINE" |
requiredstatus="ONLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
sed -i 's/[0-9]\+/0/' "${servercfgfullpath}" |
sed -i 's/[0-9]\+/0/' "${servercfgfullpath}" |
||||
(command_monitor.sh) |
(command_monitor.sh) |
||||
|
fn_test_result_fail |
||||
echo "" |
echo "" |
||||
fn_print_info_nl "Reseting ${servercfg}." |
fn_print_info_nl "Re-generating ${servercfg}." |
||||
install_config.sh |
install_config.sh |
||||
echo "" |
echo "=================================" |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
echo "" |
||||
echo "6.0 - details" |
echo "6.0 - details" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "display details." |
echo "display details." |
||||
|
echo "Command: ./jc2server details" |
||||
requiredstatus="ONLINE" |
requiredstatus="ONLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
command_details.sh |
(command_details.sh) |
||||
echo "" |
fn_test_result_pass |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
|
||||
|
|
||||
|
echo "" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Server Tests - Complete!" |
echo "Server Tests - Complete!" |
||||
echo "Using: ${gamename}" |
echo "Using: ${gamename}" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "" |
|
||||
requiredstatus="OFFLINE" |
requiredstatus="OFFLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
sleep 1 |
sleep 1 |
||||
fn_print_info "Tidying up directories." |
fn_print_info "Tidying up directories." |
||||
sleep 1 |
sleep 1 |
||||
rm -rfv ${serverfiles} |
rm -rfv "${serverfiles}" |
||||
echo "END" |
core_exit.sh |
||||
|
|
||||
|
@ -1,20 +1,46 @@ |
|||||
#!/bin/bash |
#!/bin/bash |
||||
# TravisCI Tests |
# TravisCI Tests: Teamspeak 3 |
||||
# Server Management Script |
# Server Management Script |
||||
# Author: Daniel Gibbs |
# Author: Daniel Gibbs |
||||
# Website: https://gameservermanagers.com |
# Website: https://gameservermanagers.com |
||||
version="071115" |
version="101716" |
||||
|
|
||||
|
if [ -f ".dev-debug" ]; then |
||||
|
exec 5>dev-debug.log |
||||
|
BASH_XTRACEFD="5" |
||||
|
set -x |
||||
|
fi |
||||
|
|
||||
#### Variables #### |
#### Variables #### |
||||
|
|
||||
# Alert Email |
# Notification Alerts |
||||
# (on|off) |
# (on|off) |
||||
|
|
||||
|
# Email |
||||
emailalert="off" |
emailalert="off" |
||||
email="" |
email="[email protected]" |
||||
|
|
||||
|
# Pushbullet |
||||
|
# https://www.pushbullet.com/#settings |
||||
|
pushbulletalert="off" |
||||
|
pushbullettoken="accesstoken" |
||||
|
|
||||
# Start Variables |
# Start Variables |
||||
updateonstart="off" |
updateonstart="off" |
||||
|
|
||||
|
fn_parms(){ |
||||
|
parms="" |
||||
|
} |
||||
|
|
||||
|
#### Advanced Variables #### |
||||
|
|
||||
|
# Github Branch Select |
||||
|
# Allows for the use of different function files |
||||
|
# from a different repo and/or branch. |
||||
|
githubuser="dgibbs64" |
||||
|
githubrepo="linuxgsm" |
||||
|
githubbranch="$TRAVIS_BRANCH" |
||||
|
|
||||
# Server Details |
# Server Details |
||||
gamename="Teamspeak 3" |
gamename="Teamspeak 3" |
||||
servername="Teamspeak 3 Server" |
servername="Teamspeak 3 Server" |
||||
@ -24,6 +50,9 @@ servicename="ts3-server" |
|||||
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))" |
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))" |
||||
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" |
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" |
||||
lockselfname=".${servicename}.lock" |
lockselfname=".${servicename}.lock" |
||||
|
lgsmdir="${rootdir}/lgsm" |
||||
|
functionsdir="${lgsmdir}/functions" |
||||
|
libdir="${lgsmdir}/lib" |
||||
filesdir="${rootdir}/serverfiles" |
filesdir="${rootdir}/serverfiles" |
||||
systemdir="${filesdir}" |
systemdir="${filesdir}" |
||||
executabledir="${filesdir}" |
executabledir="${filesdir}" |
||||
@ -34,7 +63,6 @@ servercfgfullpath="${servercfgdir}/${servercfg}" |
|||||
servercfgdefault="${servercfgdir}/lgsm-default.ini" |
servercfgdefault="${servercfgdir}/lgsm-default.ini" |
||||
backupdir="${rootdir}/backups" |
backupdir="${rootdir}/backups" |
||||
|
|
||||
|
|
||||
# Logging |
# Logging |
||||
logdays="7" |
logdays="7" |
||||
gamelogdir="${filesdir}/logs" |
gamelogdir="${filesdir}/logs" |
||||
@ -45,67 +73,65 @@ emaillog="${scriptlogdir}/${servicename}-email.log" |
|||||
|
|
||||
scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log" |
scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log" |
||||
|
|
||||
#### Advanced Variables #### |
|
||||
|
|
||||
# Github Branch Select |
|
||||
# Allows for the use of different function files |
|
||||
# from a different repo and/or branch. |
|
||||
githubuser="dgibbs64" |
|
||||
githubrepo="linuxgsm" |
|
||||
githubbranch="$TRAVIS_BRANCH" |
|
||||
|
|
||||
##### Script ##### |
##### Script ##### |
||||
# Do not edit |
# Do not edit |
||||
|
|
||||
fn_getgithubfile(){ |
# Fetches core_dl for file downloads |
||||
filename=$1 |
fn_fetch_core_dl(){ |
||||
exec=$2 |
github_file_url_dir="lgsm/functions" |
||||
fileurl=${3:-$filename} |
github_file_url_name="${functionfile}" |
||||
filepath="${rootdir}/${filename}" |
filedir="${functionsdir}" |
||||
filedir=$(dirname "${filepath}") |
filename="${github_file_url_name}" |
||||
# If the function file is missing, then download |
githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" |
||||
if [ ! -f "${filepath}" ]; then |
# If the file is missing, then download |
||||
|
if [ ! -f "${filedir}/${filename}" ]; then |
||||
if [ ! -d "${filedir}" ]; then |
if [ ! -d "${filedir}" ]; then |
||||
mkdir "${filedir}" |
mkdir -p "${filedir}" |
||||
fi |
fi |
||||
githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}" |
|
||||
echo -e " fetching ${filename}...\c" |
echo -e " fetching ${filename}...\c" |
||||
if [ "$(command -v curl)" ]||[ "$(which curl >/dev/null 2>&1)" ]||[ -f "/usr/bin/curl" ]||[ -f "/bin/curl" ]; then |
# Check curl exists and use available path |
||||
: |
curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)" |
||||
|
for curlcmd in ${curlpaths} |
||||
|
do |
||||
|
if [ -x "${curlcmd}" ]; then |
||||
|
break |
||||
|
fi |
||||
|
done |
||||
|
# If curl exists download file |
||||
|
if [ "$(basename ${curlcmd})" == "curl" ]; then |
||||
|
curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1) |
||||
|
if [ $? -ne 0 ]; then |
||||
|
echo -e "\e[0;31mFAIL\e[0m\n" |
||||
|
echo "${curlfetch}" |
||||
|
echo -e "${githuburl}\n" |
||||
|
exit 1 |
||||
|
else |
||||
|
echo -e "\e[0;32mOK\e[0m" |
||||
|
fi |
||||
else |
else |
||||
echo -e "\e[0;31mFAIL\e[0m\n" |
echo -e "\e[0;31mFAIL\e[0m\n" |
||||
echo "Curl is not installed!" |
echo "Curl is not installed!" |
||||
echo -e "" |
echo -e "" |
||||
exit |
exit 1 |
||||
fi |
|
||||
curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1) |
|
||||
if [ $? -ne 0 ]; then |
|
||||
echo -e "\e[0;31mFAIL\e[0m\n" |
|
||||
echo "${curl}" |
|
||||
echo -e "${githuburl}\n" |
|
||||
exit |
|
||||
else |
|
||||
echo -e "\e[0;32mOK\e[0m" |
|
||||
fi |
fi |
||||
if [ "${exec}" ]; then |
chmod +x "${filedir}/${filename}" |
||||
chmod +x "${filepath}" |
|
||||
fi |
|
||||
fi |
|
||||
if [ "${exec}" ]; then |
|
||||
source "${filepath}" |
|
||||
fi |
fi |
||||
|
source "${filedir}/${filename}" |
||||
} |
} |
||||
|
|
||||
fn_runfunction(){ |
core_dl.sh(){ |
||||
fn_getgithubfile "functions/${functionfile}" 1 |
# Functions are defined in core_functions.sh. |
||||
|
functionfile="${FUNCNAME}" |
||||
|
fn_fetch_core_dl |
||||
} |
} |
||||
|
|
||||
core_functions.sh(){ |
core_functions.sh(){ |
||||
# Functions are defined in core_functions.sh. |
# Functions are defined in core_functions.sh. |
||||
functionfile="${FUNCNAME}" |
functionfile="${FUNCNAME}" |
||||
fn_runfunction |
fn_fetch_core_dl |
||||
} |
} |
||||
|
|
||||
|
core_dl.sh |
||||
core_functions.sh |
core_functions.sh |
||||
|
|
||||
fn_currentstatus_tmux(){ |
fn_currentstatus_tmux(){ |
||||
@ -118,7 +144,7 @@ fn_currentstatus_tmux(){ |
|||||
} |
} |
||||
|
|
||||
fn_currentstatus_ts3(){ |
fn_currentstatus_ts3(){ |
||||
check_status.sh |
check_status.sh |
||||
if [ "${status}" != "0" ]; then |
if [ "${status}" != "0" ]; then |
||||
currentstatus="ONLINE" |
currentstatus="ONLINE" |
||||
else |
else |
||||
@ -132,15 +158,15 @@ fn_setstatus(){ |
|||||
echo "Required status: ${requiredstatus}" |
echo "Required status: ${requiredstatus}" |
||||
counter=0 |
counter=0 |
||||
echo "Current status: ${currentstatus}" |
echo "Current status: ${currentstatus}" |
||||
while [ "${requiredstatus}" != "${currentstatus}" ]; do |
while [ "${requiredstatus}" != "${currentstatus}" ]; do |
||||
counter=$((counter+1)) |
counter=$((counter+1)) |
||||
fn_currentstatus_ts3 |
fn_currentstatus_ts3 |
||||
echo -ne "New status: ${currentstatus}\\r" |
echo -ne "New status: ${currentstatus}\\r" |
||||
|
|
||||
if [ "${requiredstatus}" == "ONLINE" ]; then |
if [ "${requiredstatus}" == "ONLINE" ]; then |
||||
(command_start.sh) |
(command_start.sh > /dev/null 2>&1) |
||||
else |
else |
||||
(command_stop.sh) |
(command_stop.sh > /dev/null 2>&1) |
||||
fi |
fi |
||||
if [ "${counter}" -gt "5" ]; then |
if [ "${counter}" -gt "5" ]; then |
||||
currentstatus="FAIL" |
currentstatus="FAIL" |
||||
@ -157,6 +183,44 @@ fn_setstatus(){ |
|||||
sleep 0.5 |
sleep 0.5 |
||||
} |
} |
||||
|
|
||||
|
# End of every test will expect the result to either pass or fail |
||||
|
# If the script does not do as intended the whole test will fail |
||||
|
# if excpecting a pass |
||||
|
fn_test_result_pass(){ |
||||
|
if [ $? != 0 ]; then |
||||
|
echo "=================================" |
||||
|
echo "Expected result: PASS" |
||||
|
echo "Actual result: FAIL" |
||||
|
fn_print_fail_nl "TEST FAILED" |
||||
|
exitcode=1 |
||||
|
core_exit.sh |
||||
|
else |
||||
|
echo "=================================" |
||||
|
echo "Expected result: PASS" |
||||
|
echo "Actual result: PASS" |
||||
|
fn_print_ok_nl "TEST PASSED" |
||||
|
echo "" |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
# if excpecting a fail |
||||
|
fn_test_result_fail(){ |
||||
|
if [ $? == 0 ]; then |
||||
|
echo "=================================" |
||||
|
echo "Expected result: FAIL" |
||||
|
echo "Actual result: PASS" |
||||
|
fn_print_fail_nl "TEST FAILED" |
||||
|
exitcode=1 |
||||
|
core_exit.sh |
||||
|
else |
||||
|
echo "=================================" |
||||
|
echo "Expected result: FAIL" |
||||
|
echo "Actual result: FAIL" |
||||
|
fn_print_ok_nl "TEST PASSED" |
||||
|
echo "" |
||||
|
fi |
||||
|
} |
||||
|
|
||||
echo "=================================" |
echo "=================================" |
||||
echo "TravisCI Tests" |
echo "TravisCI Tests" |
||||
echo "Linux Game Server Manager" |
echo "Linux Game Server Manager" |
||||
@ -164,232 +228,213 @@ echo "by Daniel Gibbs" |
|||||
echo "https://gameservermanagers.com" |
echo "https://gameservermanagers.com" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "" |
echo "" |
||||
sleep 1 |
|
||||
echo "=================================" |
echo "=================================" |
||||
echo "Server Tests" |
echo "Server Tests" |
||||
echo "Using: ${gamename}" |
echo "Using: ${gamename}" |
||||
|
echo "Testing Branch: $TRAVIS_BRANCH" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "" |
echo "" |
||||
sleep 1 |
|
||||
|
|
||||
|
echo "0.1 - Create log dir's" |
||||
|
echo "=================================" |
||||
|
echo "Description:" |
||||
|
echo "Create log dir's" |
||||
|
echo "" |
||||
|
(install_logs.sh) |
||||
|
|
||||
|
|
||||
|
echo "0.2 - Enable dev-debug" |
||||
|
echo "=================================" |
||||
|
echo "Description:" |
||||
|
echo "Enable dev-debug" |
||||
|
echo "" |
||||
|
(command_dev_debug.sh) |
||||
|
fn_test_result_pass |
||||
|
|
||||
echo "1.0 - start - no files" |
echo "1.0 - start - no files" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "test script reaction to missing server files." |
echo "test script reaction to missing server files." |
||||
|
echo "Command: ./ts3server start" |
||||
echo "" |
echo "" |
||||
(command_start.sh) |
(command_start.sh) |
||||
echo "" |
fn_test_result_fail |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "1.1 - getopt" |
echo "1.1 - getopt" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "displaying options messages." |
echo "displaying options messages." |
||||
|
echo "Command: ./ts3server" |
||||
echo "" |
echo "" |
||||
(core_getopt.sh) |
(core_getopt.sh) |
||||
|
fn_test_result_pass |
||||
|
|
||||
echo "" |
echo "" |
||||
echo "Test complete!" |
echo "1.2 - getopt with incorrect args" |
||||
sleep 1 |
echo "=================================" |
||||
|
echo "Description:" |
||||
|
echo "displaying options messages." |
||||
|
echo "Command: ./ts3server abc123" |
||||
echo "" |
echo "" |
||||
|
getopt="abc123" |
||||
|
(core_getopt.sh) |
||||
|
fn_test_result_fail |
||||
|
|
||||
|
echo "" |
||||
|
|
||||
echo "2.0 - install" |
echo "2.0 - install" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "install ${gamename} server." |
echo "install ${gamename} server." |
||||
fn_autoinstall |
echo "Command: ./ts3server auto-install" |
||||
echo "" |
(fn_autoinstall) |
||||
echo "Test complete!" |
fn_test_result_pass |
||||
sleep 1 |
|
||||
echo "" |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
echo "" |
||||
echo "3.1 - start" |
echo "3.1 - start" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "start ${gamename} server." |
echo "start ${gamename} server." |
||||
|
echo "Command: ./ts3server start" |
||||
requiredstatus="OFFLINE" |
requiredstatus="OFFLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
command_start.sh |
(command_start.sh) |
||||
echo "" |
fn_test_result_pass |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "3.2 - start - online" |
echo "3.2 - start - online" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "start ${gamename} server while already running." |
echo "start ${gamename} server while already running." |
||||
|
echo "Command: ./ts3server start" |
||||
requiredstatus="ONLINE" |
requiredstatus="ONLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
(command_start.sh) |
(command_start.sh) |
||||
echo "" |
fn_test_result_fail |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "3.3 - start - updateonstart" |
echo "3.3 - start - updateonstart" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "will update server on start." |
echo "will update server on start." |
||||
|
echo "Command: ./ts3server start" |
||||
requiredstatus="OFFLINE" |
requiredstatus="OFFLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
( |
(updateonstart="on";command_start.sh) |
||||
updateonstart="on" |
fn_test_result_pass |
||||
command_start.sh |
|
||||
) |
|
||||
echo "" |
|
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "3.4 - stop" |
echo "3.4 - stop" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "stop ${gamename} server." |
echo "stop ${gamename} server." |
||||
|
echo "Command: ./ts3server stop" |
||||
requiredstatus="ONLINE" |
requiredstatus="ONLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
command_stop.sh |
(command_stop.sh) |
||||
echo "" |
fn_test_result_pass |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "3.5 - stop - offline" |
echo "3.5 - stop - offline" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "stop ${gamename} server while already stopped." |
echo "stop ${gamename} server while already stopped." |
||||
|
echo "Command: ./ts3server stop" |
||||
requiredstatus="OFFLINE" |
requiredstatus="OFFLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
(command_stop.sh) |
(command_stop.sh) |
||||
echo "" |
fn_test_result_fail |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "3.6 - restart" |
echo "3.6 - restart" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "restart ${gamename}." |
echo "restart ${gamename}." |
||||
|
echo "Command: ./ts3server restart" |
||||
requiredstatus="ONLINE" |
requiredstatus="ONLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
fn_restart |
(command_restart.sh) |
||||
echo "" |
fn_test_result_pass |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
echo "" |
||||
echo "3.7 - restart - offline" |
echo "3.7 - restart - offline" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "restart ${gamename} while already stopped." |
echo "restart ${gamename} while already stopped." |
||||
|
echo "Command: ./ts3server restart" |
||||
requiredstatus="OFFLINE" |
requiredstatus="OFFLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
fn_restart |
(command_restart.sh) |
||||
echo "" |
fn_test_result_pass |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
|
||||
|
|
||||
|
|
||||
|
|
||||
echo "4.1 - update" |
echo "4.1 - update" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "check for updates." |
echo "check for updates." |
||||
|
echo "Command: ./jc2server update" |
||||
requiredstatus="OFFLINE" |
requiredstatus="OFFLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
update_check.sh |
(command_update.sh) |
||||
echo "" |
fn_test_result_pass |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
|
||||
echo "4.1 - update - old version" |
|
||||
echo "=================================" |
|
||||
echo "Description:" |
|
||||
echo "change the version number tricking LGSM to update." |
|
||||
requiredstatus="OFFLINE" |
|
||||
sed -i 's/[0-9]\+/0/g' ${gamelogdir}/ts3server*_0.log |
|
||||
fn_setstatus |
|
||||
update_check.sh |
|
||||
echo "" |
|
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
|
||||
|
|
||||
|
echo "" |
||||
echo "5.1 - monitor - online" |
echo "5.1 - monitor - online" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "run monitor server while already running." |
echo "run monitor server while already running." |
||||
|
echo "Command: ./ts3server monitor" |
||||
requiredstatus="ONLINE" |
requiredstatus="ONLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
(command_monitor.sh) |
(command_monitor.sh) |
||||
|
fn_test_result_pass |
||||
|
|
||||
|
|
||||
echo "" |
echo "" |
||||
echo "Test complete!" |
echo "5.2 - monitor - offline - with lockfile" |
||||
sleep 1 |
|
||||
echo "" |
|
||||
echo "5.2 - monitor - offline - no lockfile" |
|
||||
echo "=================================" |
|
||||
echo "Description:" |
|
||||
echo "run monitor while server is offline with no lockfile." |
|
||||
requiredstatus="OFFLINE" |
|
||||
fn_setstatus |
|
||||
(command_monitor.sh) |
|
||||
echo "" |
|
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
|
||||
echo "5.3 - monitor - offline - with lockfile" |
|
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "run monitor while server is offline with no lockfile." |
echo "run monitor while server is offline with lockfile." |
||||
|
echo "Command: ./ts3server monitor" |
||||
requiredstatus="OFFLINE" |
requiredstatus="OFFLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
fn_print_info_nl "creating lockfile." |
fn_print_info_nl "creating lockfile." |
||||
date > "${rootdir}/${lockselfname}" |
date > "${rootdir}/${lockselfname}" |
||||
(command_monitor.sh) |
(command_monitor.sh) |
||||
|
fn_test_result_pass |
||||
|
|
||||
|
|
||||
echo "" |
echo "" |
||||
echo "Test complete!" |
echo "5.3 - monitor - offline - no lockfile" |
||||
sleep 1 |
|
||||
echo "" |
|
||||
echo "5.4 - monitor - gsquery.py failure" |
|
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "gsquery.py will fail to query port." |
echo "run monitor while server is offline with no lockfile." |
||||
requiredstatus="ONLINE" |
echo "Command: ./ts3server monitor" |
||||
|
requiredstatus="OFFLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
sed -i 's/[0-9]\+/0/' "${servercfgfullpath}" |
|
||||
(command_monitor.sh) |
(command_monitor.sh) |
||||
echo "" |
fn_test_result_fail |
||||
fn_print_info_nl "Reseting ${servercfg}." |
|
||||
install_config.sh |
|
||||
echo "" |
|
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
echo "" |
||||
echo "6.0 - details" |
echo "6.0 - details" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Description:" |
echo "Description:" |
||||
echo "display details." |
echo "display details." |
||||
|
echo "Command: ./ts3server details" |
||||
requiredstatus="ONLINE" |
requiredstatus="ONLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
command_details.sh |
(command_details.sh) |
||||
echo "" |
fn_test_result_pass |
||||
echo "Test complete!" |
|
||||
sleep 1 |
|
||||
echo "" |
|
||||
|
|
||||
|
echo "" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "Server Tests - Complete!" |
echo "Server Tests - Complete!" |
||||
echo "Using: ${gamename}" |
echo "Using: ${gamename}" |
||||
echo "=================================" |
echo "=================================" |
||||
echo "" |
|
||||
requiredstatus="OFFLINE" |
requiredstatus="OFFLINE" |
||||
fn_setstatus |
fn_setstatus |
||||
sleep 1 |
sleep 1 |
||||
fn_print_info "Tidying up directories." |
fn_print_info "Tidying up directories." |
||||
sleep 1 |
sleep 1 |
||||
rm -rfv ${serverfiles} |
rm -rfv "${serverfiles}" |
||||
echo "END" |
core_exit.sh |
||||
|
Loading…
Reference in new issue