Browse Source

Fixed uniqueness constraint on session names by adding port to tmux sesssions. Removed content constraint from session name by avoiding grep regex

merge


merge


merge


merge

merge
pull/3081/head
Daniel Gibbs 5 years ago
parent
commit
bfc46568a7
  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

6
lgsm/functions/check_status.sh

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

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}"
tmux attach-session -t "${sessionname}${port}"
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}" version ENTER > /dev/null 2>&1
tmux send -t "${sessionname}${port}" 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}" "${executable} ${parms}" 2> "${lgsmlogdir}/.${selfname}-tmux-error.tmp"
tmux new-session -d -x "${sessionwidth}" -y "${sessionheight}" -s "${sessionname}${port}" "${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}\" \"${executable} ${parms}\"" | tee -a "${lgsmlog}"
echo -e "tmux new-session -d -s \"${sessionname} ${port}\" \"${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}" C-c > /dev/null 2>&1
tmux send-keys -t "${sessionname}${port}" 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

Loading…
Cancel
Save