Răsfoiți Sursa

Introducing the tmuxception !

UltimateByte 9 ani în urmă
părinte
comite
1a01ece469
1 a modificat fișierele cu 29 adăugiri și 0 ștergeri
  1. 29 0
      lgsm/functions/check_tmuxception.sh

+ 29 - 0
lgsm/functions/check_tmuxception.sh

@@ -0,0 +1,29 @@
+#!/bin/bash
+# LGSM check_config.sh function
+# Author: Daniel Gibbs
+# Contributor: UltimateByte
+# Website: https://gameservermanagers.com
+# Description: Checks if run from tmux or screen
+
+local commandname="check"
+
+fn_check_is_in_tmux(){
+  if [ -n "${TMUX}" ];then
+		fn_print_fail_nl "tmuxception error: Sorry Cobb you cannot start a tmux session inside of a tmux session."
+		fn_script_log_fatal "tmuxception error: Attempted to start a tmux session inside of a tmux session."
+		fn_print_information_nl "LGSM creates a tmux session when starting the server."
+		echo "It is not possible to run a tmux session inside another tmux session"
+		echo "https://github.com/GameServerManagers/LinuxGSM/wiki/Tmux#tmuxception"
+		core_exit.sh
+	fi
+}
+fn_check_is_in_screen(){
+	if [ "$TERM" == "screen" ];then
+		fn_print_fail_nl "tmuxception error: Sorry Cobb you cannot start a tmux session inside of a screen session."
+		fn_script_log_fatal "tmuxception error: Attempted to start a tmux session inside of a screen session."
+		fn_print_information_nl "LGSM creates a tmux session when starting the server."
+		echo "It is not possible to run a tmux session inside screen session"
+		echo "https://github.com/GameServerManagers/LinuxGSM/wiki/Tmux#tmuxception"
+		core_exit.sh
+	fi
+}