Browse Source

Revert "feat: improve uniqueness tmux session name (#3081)"

This reverts commit 990edfd775.
pull/3142/head
Daniel Gibbs 4 years ago
parent
commit
b19c9a0a4a
  1. 6
      lgsm/functions/check_status.sh
  2. 2
      lgsm/functions/command_console.sh
  3. 6
      lgsm/functions/command_start.sh
  4. 2
      lgsm/functions/command_stop.sh
  5. 2
      lgsm/functions/info_distro.sh

6
lgsm/functions/check_status.sh

@ -7,8 +7,4 @@
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ "$(tmux list-sessions -F "#{session_name}" 2>/dev/null)" == "${sessionname}${port}" ]; then
status=1;
else
status=0;
fi
status=$(tmux list-sessions -F "#{session_name}" 2>/dev/null | grep -Ecx "^${sessionname}")

2
lgsm/functions/command_console.sh

@ -41,7 +41,7 @@ check_status.sh
if [ "${status}" != "0" ]; then
fn_print_ok_nl "Accessing console"
fn_script_log_pass "Console accessed"
tmux attach-session -t "${sessionname}${port}"
tmux attach-session -t "${sessionname}"
fn_print_ok_nl "Closing console"
fn_script_log_pass "Console closed"
else

6
lgsm/functions/command_start.sh

@ -36,7 +36,7 @@ fn_start_teamspeak3(){
# Used to allow update to detect JK2MV server version.
fn_start_jk2(){
fn_start_tmux
tmux send -t "${sessionname}${port}" version ENTER > /dev/null 2>&1
tmux send -t "${sessionname}" version ENTER > /dev/null 2>&1
}
fn_start_tmux(){
@ -72,7 +72,7 @@ fn_start_tmux(){
# Create lockfile
date '+%s' > "${lockdir}/${selfname}.lock"
cd "${executabledir}" || exit
tmux new-session -d -x "${sessionwidth}" -y "${sessionheight}" -s "${sessionname}${port}" "${executable} ${parms}" 2> "${lgsmlogdir}/.${selfname}-tmux-error.tmp"
tmux new-session -d -x "${sessionwidth}" -y "${sessionheight}" -s "${sessionname}" "${executable} ${parms}" 2> "${lgsmlogdir}/.${selfname}-tmux-error.tmp"
# Create logfile.
touch "${consolelog}"
@ -130,7 +130,7 @@ fn_start_tmux(){
echo -e ""
echo -e "Command"
echo -e "================================="
echo -e "tmux new-session -d -s \"${sessionname} ${port}\" \"${executable} ${parms}\"" | tee -a "${lgsmlog}"
echo -e "tmux new-session -d -s \"${sessionname}\" \"${executable} ${parms}\"" | tee -a "${lgsmlog}"
echo -e ""
echo -e "Error"
echo -e "================================="

2
lgsm/functions/command_stop.sh

@ -15,7 +15,7 @@ fn_stop_graceful_ctrlc(){
fn_print_dots "Graceful: CTRL+c"
fn_script_log_info "Graceful: CTRL+c"
# Sends quit.
tmux send-keys -t "${sessionname}${port}" C-c > /dev/null 2>&1
tmux send-keys -t "${sessionname}" C-c > /dev/null 2>&1
# Waits up to 30 seconds giving the server time to shutdown gracefuly.
for seconds in {1..30}; do
check_status.sh

2
lgsm/functions/info_distro.sh

@ -9,7 +9,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
### Game Server pid
if [ "${status}" == "1" ]; then
gameserverpid=$(tmux list-sessions -F "#{session_name} #{pane_pid}" | grep "^${sessionname}${port}" | awk '{print $NF}')
gameserverpid=$(tmux list-sessions -F "#{session_name} #{pane_pid}" | grep "^${sessionname} " | awk '{print $NF}')
fi
### Distro information

Loading…
Cancel
Save