Browse Source

Revert "Resshuffled code to better suite exitcodes"

This reverts commit 6deeb0a706.
pull/914/head
Daniel Gibbs 9 years ago
parent
commit
f9fe306ce6
  1. 17
      lgsm/functions/command_start.sh

17
lgsm/functions/command_start.sh

@ -72,34 +72,36 @@ fn_start_tmux(){
mv "${consolelog}" "${consolelogdate}"
fi
# If server is already running exit
check_status.sh
if [ "${status}" != "0" ]; then
# If server is already running exit
fn_print_info_nl "${servername} is already running"
fn_script_log_error "${servername} is already running"
else
core_exit.sh
fi
# Create lock file
date > "${rootdir}/${lockselfname}"
# Start session
cd "${executabledir}"
tmux new-session -d -s "${servicename}" "${executable} ${parms}" 2> "${scriptlogdir}/.${servicename}-tmux-error.tmp"
## Console logging
# 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 "https://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 "https://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}"
@ -108,7 +110,7 @@ fn_start_tmux(){
fi
sleep 1
# Check if the server fails to start
# If the server fails to start
check_status.sh
if [ "${status}" == "0" ]; then
fn_print_fail_nl "Unable to start ${servername}"
@ -153,13 +155,14 @@ fn_start_tmux(){
fi
fi
fi
core_exit.sh
else
fn_print_ok "${servername}"
fn_script_log_pass "Started ${servername}"
fi
rm "${scriptlogdir}/.${servicename}-tmux-error.tmp"
echo -en "\n"
fi
}
check.sh

Loading…
Cancel
Save