check_tmuxception.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. # LGSM check_config.sh function
  3. # Author: Daniel Gibbs
  4. # Contributor: UltimateByte
  5. # Website: https://gameservermanagers.com
  6. # Description: Checks if run from tmux or screen
  7. local commandname="check"
  8. fn_check_is_in_tmux(){
  9. if [ -n "${TMUX}" ];then
  10. fn_print_fail_nl "tmuxception error: Sorry Cobb you cannot start a tmux session inside of a tmux session."
  11. fn_script_log_fatal "tmuxception error: Attempted to start a tmux session inside of a tmux session."
  12. fn_print_information_nl "LGSM creates a tmux session when starting the server."
  13. echo "It is not possible to run a tmux session inside another tmux session"
  14. echo "https://github.com/GameServerManagers/LinuxGSM/wiki/Tmux#tmuxception"
  15. core_exit.sh
  16. fi
  17. }
  18. fn_check_is_in_screen(){
  19. if [ "$TERM" == "screen" ];then
  20. fn_print_fail_nl "tmuxception error: Sorry Cobb you cannot start a tmux session inside of a screen session."
  21. fn_script_log_fatal "tmuxception error: Attempted to start a tmux session inside of a screen session."
  22. fn_print_information_nl "LGSM creates a tmux session when starting the server."
  23. echo "It is not possible to run a tmux session inside screen session"
  24. echo "https://github.com/GameServerManagers/LinuxGSM/wiki/Tmux#tmuxception"
  25. core_exit.sh
  26. fi
  27. }
  28. fn_check_is_in_tmux
  29. fn_check_is_in_screen