|
|
@ -2,7 +2,7 @@ |
|
|
|
# LGSM command_start.sh function |
|
|
|
# Author: Daniel Gibbs |
|
|
|
# Website: http://gameservermanagers.com |
|
|
|
lgsm_version="070116" |
|
|
|
lgsm_version="060516" |
|
|
|
|
|
|
|
# Description: Starts the server. |
|
|
|
|
|
|
@ -10,16 +10,6 @@ local modulename="Starting" |
|
|
|
function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" |
|
|
|
|
|
|
|
fn_start_teamspeak3(){ |
|
|
|
check.sh |
|
|
|
info_ts3status.sh |
|
|
|
|
|
|
|
if [ "${ts3status}" != "Server is running" ]; then |
|
|
|
# Will check for updates is updateonstart is yes |
|
|
|
if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then |
|
|
|
update_check.sh |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
if [ ! -e "${servercfgfullpath}" ]; then |
|
|
|
fn_print_warn_nl "${servercfgfullpath} is missing" |
|
|
|
fn_scriptlog "${servercfgfullpath} is missing" |
|
|
@ -35,13 +25,11 @@ fn_start_teamspeak3(){ |
|
|
|
touch "${servercfgfullpath}" |
|
|
|
fi |
|
|
|
|
|
|
|
logs.sh |
|
|
|
|
|
|
|
fn_print_dots "${servername}" |
|
|
|
fn_scriptlog "${servername}" |
|
|
|
sleep 1 |
|
|
|
|
|
|
|
if [ "${ts3status}" == "Server is running" ]; then |
|
|
|
check_status.sh |
|
|
|
if [ "${status}" != "0" ]; then |
|
|
|
fn_print_info_nl "${servername} is already running" |
|
|
|
fn_scriptlog "${servername} is already running" |
|
|
|
exit |
|
|
@ -57,8 +45,8 @@ fn_start_teamspeak3(){ |
|
|
|
./ts3server_startscript.sh start inifile="${servercfgfullpath}" > /dev/null 2>&1 |
|
|
|
fi |
|
|
|
sleep 1 |
|
|
|
info_ts3status.sh |
|
|
|
if [ "${ts3status}" = "Server seems to have died" ]||[ "${ts3status}" = "No server running (ts3server.pid is missing)" ]; then |
|
|
|
check_status.sh |
|
|
|
if [ "${status}" == "0" ]; then |
|
|
|
fn_print_fail_nl "Unable to start ${servername}" |
|
|
|
fn_scriptlog "Unable to start ${servername}" |
|
|
|
echo -e " Check log files: ${rootdir}/log" |
|
|
@ -70,25 +58,13 @@ fn_start_teamspeak3(){ |
|
|
|
} |
|
|
|
|
|
|
|
fn_start_tmux(){ |
|
|
|
check.sh |
|
|
|
fix.sh |
|
|
|
info_config.sh |
|
|
|
fn_parms |
|
|
|
logs.sh |
|
|
|
|
|
|
|
tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:") |
|
|
|
# Will check for updates if updateonstart is yes |
|
|
|
if [ "${tmuxwc}" -eq 0 ]; then |
|
|
|
if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then |
|
|
|
update_check.sh |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
fn_print_dots "${servername}" |
|
|
|
fn_scriptlog "${servername}" |
|
|
|
sleep 1 |
|
|
|
|
|
|
|
if [ "${tmuxwc}" -eq 0 ]; then |
|
|
|
# Log rotation |
|
|
|
check_status.sh |
|
|
|
if [ "${status}" == "0" ]; then |
|
|
|
fn_scriptlog "Rotating log files" |
|
|
|
if [ "${engine}" == "unreal2" ]; then |
|
|
|
mv "${gamelog}" "${gamelogdate}" |
|
|
@ -97,7 +73,9 @@ if [ "${tmuxwc}" -eq 0 ]; then |
|
|
|
mv "${consolelog}" "${consolelogdate}" |
|
|
|
fi |
|
|
|
|
|
|
|
if [ "${tmuxwc}" -eq 1 ]; then |
|
|
|
# If server is already running exit |
|
|
|
check_status.sh |
|
|
|
if [ "${status}" != "0" ]; then |
|
|
|
fn_print_info_nl "${servername} is already running" |
|
|
|
fn_scriptlog "${servername} is already running" |
|
|
|
exit |
|
|
@ -107,19 +85,24 @@ fi |
|
|
|
date > "${rootdir}/${lockselfname}" |
|
|
|
cd "${executabledir}" |
|
|
|
tmux new-session -d -s "${servicename}" "${executable} ${parms}" 2> "${scriptlogdir}/.${servicename}-tmux-error.tmp" |
|
|
|
|
|
|
|
# tmux pipe-pane not supported in tmux versions < 1.6 |
|
|
|
if [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -lt "16" ]; then |
|
|
|
echo "Console logging disabled: Tmux => 1.6 required" >> "${consolelog}" |
|
|
|
echo "http://gameservermanagers.com/tmux-upgrade" >> "${consolelog}" |
|
|
|
echo "Currently installed: $(tmux -V)" >> "${consolelog}" |
|
|
|
|
|
|
|
# Console logging disabled: Bug in tmux 1.8 breaks logging |
|
|
|
elif [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -eq "18" ]; then |
|
|
|
echo "Console logging disabled: Bug in tmux 1.8 breaks logging" >> "${consolelog}" |
|
|
|
echo "http://gameservermanagers.com/tmux-upgrade" >> "${consolelog}" |
|
|
|
echo "Currently installed: $(tmux -V)" >> "${consolelog}" |
|
|
|
|
|
|
|
# Console logging enable or not set |
|
|
|
elif [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then |
|
|
|
touch "${consolelog}" |
|
|
|
tmux pipe-pane -o -t "${servicename}" "exec cat >> '${consolelog}'" |
|
|
|
|
|
|
|
# Console logging disabled |
|
|
|
elif [ "${consolelogging}" == "off" ]; then |
|
|
|
touch "${consolelog}" |
|
|
@ -127,9 +110,10 @@ elif [ "${consolelogging}" == "off" ]; then |
|
|
|
fn_scriptlog "Console logging disabled by user" |
|
|
|
fi |
|
|
|
sleep 1 |
|
|
|
tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:") |
|
|
|
|
|
|
|
# If the server fails to start |
|
|
|
if [ "${tmuxwc}" -eq 0 ]; then |
|
|
|
check_status.sh |
|
|
|
if [ "${status}" == "0" ]; then |
|
|
|
fn_print_fail_nl "Unable to start ${servername}" |
|
|
|
fn_scriptlog "Unable to start ${servername}" |
|
|
|
sleep 1 |
|
|
@ -181,6 +165,19 @@ rm "${scriptlogdir}/.${servicename}-tmux-error.tmp" |
|
|
|
echo -en "\n" |
|
|
|
} |
|
|
|
|
|
|
|
check.sh |
|
|
|
fix.sh |
|
|
|
info_config.sh |
|
|
|
fn_parms |
|
|
|
logs.sh |
|
|
|
|
|
|
|
# Will check for updates is updateonstart is yes |
|
|
|
if [ "${status}" == "0" ]; then |
|
|
|
if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then |
|
|
|
update_check.sh |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
if [ "${gamename}" == "Teamspeak 3" ]; then |
|
|
|
fn_start_teamspeak3 |
|
|
|
else |
|
|
|