4
0

check_tmuxception.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. # LinuxGSM check_config.sh function
  3. # Author: Daniel Gibbs
  4. # Contributor: UltimateByte
  5. # Website: https://linuxgsm.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 "LinuxGSM 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://docs.linuxgsm.com/requirements/tmux#tmuxception"
  15. core_exit.sh
  16. fi
  17. }
  18. fn_check_is_in_screen(){
  19. if [ -n "${STY}" ]; 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 "LinuxGSM 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://docs.linuxgsm.com/requirements/tmux#tmuxception"
  25. core_exit.sh
  26. fi
  27. }
  28. fn_check_is_in_tmux
  29. fn_check_is_in_screen