Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lgsm/modules/check_status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"

status=$(tmux -L "${socketname}" list-sessions -F "#{session_name}" 2> /dev/null | grep -Ecx "^${sessionname}")
status=$(TERM=screen tmux -L "${socketname}" list-sessions -F "#{session_name}" 2>/dev/null | grep -Ecx "^${sessionname}")
2 changes: 1 addition & 1 deletion lgsm/modules/command_send.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if [ "${status}" != "0" ]; then
echo ""
fn_print_dots "Sending command to console: \"${commandtosend}\""
fn_print_ok_nl "Sending command to console: \"${commandtosend}\""
tmux -L "${socketname}" send-keys -t "${sessionname}" "${commandtosend}" ENTER
TERM=screen tmux -L "${socketname}" send-keys -t "${sessionname}" "${commandtosend}" ENTER
fn_script_log_pass "Command \"${commandtosend}\" sent to console"
else
fn_print_error_nl "Unable to send command to console. Server not running"
Expand Down
8 changes: 4 additions & 4 deletions lgsm/modules/command_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn_firstcommand_set
# Used to allow update to detect JK2MV server version.
fn_start_jk2() {
fn_start_tmux
tmux -L "${socketname}" end -t "${sessionname}" version ENTER > /dev/null 2>&1
TERM=screen tmux -L "${socketname}" end -t "${sessionname}" version ENTER > /dev/null 2>&1
}

fn_start_tmux() {
Expand Down Expand Up @@ -67,7 +67,7 @@ fn_start_tmux() {
cd "${executabledir}" || exit
fi

tmux -L "${socketname}" new-session -d -x "${sessionwidth}" -y "${sessionheight}" -s "${sessionname}" "${preexecutable} ${executable} ${startparameters}" 2> "${lgsmlogdir}/.${selfname}-tmux-error.tmp"
TERM=screen tmux -L "${socketname}" new-session -d -x "${sessionwidth}" -y "${sessionheight}" -s "${sessionname}" "${preexecutable} ${executable} ${startparameters}" 2> "${lgsmlogdir}/.${selfname}-tmux-error.tmp"

# Create logfile.
touch "${consolelog}"
Expand All @@ -82,9 +82,9 @@ fn_start_tmux() {
if [ "${consolelogging}" == "on" ] || [ -z "${consolelogging}" ]; then
# timestamp will break mcb update check.
if [ "${logtimestamp}" == "on" ] && [ "${shortname}" != "mcb" ]; then
tmux -L "${socketname}" pipe-pane -o -t "${sessionname}" "exec bash -c \"cat | $addtimestamp\" >> '${consolelog}'"
TERM=screen tmux -L "${socketname}" pipe-pane -o -t "${sessionname}" "exec bash -c \"cat | $addtimestamp\" >> '${consolelog}'"
else
tmux -L "${socketname}" pipe-pane -o -t "${sessionname}" "exec cat >> '${consolelog}'"
TERM=screen tmux -L "${socketname}" pipe-pane -o -t "${sessionname}" "exec cat >> '${consolelog}'"
fi
else
echo -e "Console logging disabled in settings" >> "${consolelog}"
Expand Down
12 changes: 6 additions & 6 deletions lgsm/modules/command_stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn_stop_graceful_ctrlc() {
fn_print_dots "Graceful: CTRL+c"
fn_script_log_info "Graceful: CTRL+c"
# Sends CTRL+c.
tmux -L "${socketname}" send-keys -t "${sessionname}" C-c > /dev/null 2>&1
TERM=screen tmux -L "${socketname}" 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
Expand Down Expand Up @@ -47,7 +47,7 @@ fn_stop_graceful_cmd() {
fn_print_dots "Graceful: sending \"${1}\""
fn_script_log_info "Graceful: sending \"${1}\""
# Sends specific stop command.
tmux -L "${socketname}" send -t "${sessionname}" ENTER "${1}" ENTER > /dev/null 2>&1
TERM=screen tmux -L "${socketname}" send -t "${sessionname}" ENTER "${1}" ENTER > /dev/null 2>&1
# Waits up to ${seconds} seconds giving the server time to shutdown gracefully.
for ((seconds = 1; seconds <= ${2}; seconds++)); do
check_status.sh
Expand Down Expand Up @@ -79,7 +79,7 @@ fn_stop_graceful_goldsrc() {
fn_print_dots "Graceful: sending \"quit\""
fn_script_log_info "Graceful: sending \"quit\""
# sends quit
tmux -L "${socketname}" send -t "${sessionname}" quit ENTER > /dev/null 2>&1
TERM=screen tmux -L "${socketname}" send -t "${sessionname}" quit ENTER > /dev/null 2>&1
# Waits 3 seconds as goldsrc servers restart with the quit command.
for seconds in {1..3}; do
fn_sleep_time_1
Expand Down Expand Up @@ -289,10 +289,10 @@ fn_stop_graceful_avorion() {
fn_print_dots "Graceful: /save /stop"
fn_script_log_info "Graceful: /save /stop"
# Sends /save.
tmux -L "${socketname}" send-keys -t "${sessionname}" /save ENTER > /dev/null 2>&1
TERM=screen tmux -L "${socketname}" send-keys -t "${sessionname}" /save ENTER > /dev/null 2>&1
fn_sleep_time_5
# Sends /quit.
tmux -L "${socketname}" send-keys -t "${sessionname}" /stop ENTER > /dev/null 2>&1
TERM=screen tmux -L "${socketname}" send-keys -t "${sessionname}" /stop ENTER > /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
Expand Down Expand Up @@ -351,7 +351,7 @@ fn_stop_tmux() {
fn_print_dots "${servername}"
fn_script_log_info "tmux kill-session: ${sessionname}: ${servername}"
# Kill tmux session.
tmux -L "${socketname}" kill-session -t "${sessionname}" > /dev/null 2>&1
TERM=screen tmux -L "${socketname}" kill-session -t "${sessionname}" > /dev/null 2>&1
fn_sleep_time_1
check_status.sh
if [ "${status}" == "0" ]; then
Expand Down
2 changes: 1 addition & 1 deletion lgsm/modules/info_distro.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"

### Game Server pid
if [ "${status}" == "1" ]; then
gameserverpid="$(tmux -L "${socketname}" list-sessions -F "#{session_name} #{pane_pid}" | grep "^${sessionname} " | awk '{print $NF}')"
gameserverpid="$(TERM=screen tmux -L "${socketname}" list-sessions -F "#{session_name} #{pane_pid}" | grep "^${sessionname} " | awk '{print $NF}')"
if [ "${engine}" == "source" ]; then
srcdslinuxpid="$(ps -ef | grep -v grep | grep "${gameserverpid}" | grep srcds_linux | awk '{print $2}')"
elif [ "${engine}" == "goldsrc" ]; then
Expand Down
4 changes: 2 additions & 2 deletions lgsm/modules/update_xnt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ fn_update_localbuild() {
check_status.sh
# Send version command to Xonotic server.
if [ "${status}" != "0" ]; then
tmux -L "${socketname}" send-keys -t "${sessionname}" "version" C-m > /dev/null 2>&1
TERM=screen tmux -L "${socketname}" send-keys -t "${sessionname}" "version" C-m > /dev/null 2>&1
fn_sleep_time_1
else
exitbypass=1
command_start.sh
fn_firstcommand_reset
exitbypass=1
fn_sleep_time_5
tmux -L "${socketname}" send-keys -t "${sessionname}" "version" C-m > /dev/null 2>&1
TERM=screen tmux -L "${socketname}" send-keys -t "${sessionname}" "version" C-m > /dev/null 2>&1
command_stop.sh
fn_firstcommand_reset
fi
Expand Down