command_console.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. # LinuxGSM command_console.sh function
  3. # Author: Daniel Gibbs
  4. # Website: https://linuxgsm.com
  5. # Description: Gives access to the server tmux console.
  6. fn_commandname(){
  7. commandname="CONSOLE"
  8. commandaction="Access console"
  9. functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
  10. }
  11. fn_commandname
  12. check.sh
  13. fn_print_header
  14. if [ "${shortname}" == "rust" ]||[ "${shortname}" == "hw" ]||[ "${shortname}" == "ark" ]; then
  15. fn_print_information_nl "${gamename} does not produce a verbose output to the console"
  16. fn_print_information_nl "${gamename} does not allow server commands to be entered in to the console"
  17. fi
  18. fn_print_information_nl "Press \"CTRL+b\" then \"d\" to exit console."
  19. fn_print_warning_nl "Do NOT press CTRL+c to exit."
  20. echo -e " * https://docs.linuxgsm.com/commands/console"
  21. echo -e ""
  22. if ! fn_prompt_yn "Continue?" Y; then
  23. return
  24. fi
  25. fn_print_dots "Accessing console"
  26. check_status.sh
  27. if [ "${status}" != "0" ]; then
  28. fn_print_ok_nl "Accessing console"
  29. fn_script_log_pass "Console accessed"
  30. tmux attach-session -t "${sessionname}"
  31. fn_print_ok_nl "Closing console"
  32. fn_script_log_pass "Console closed"
  33. else
  34. fn_print_error_nl "Server not running"
  35. fn_script_log_error "Failed to access: Server not running"
  36. if fn_prompt_yn "Do you want to start the server?" Y; then
  37. exitbypass=1
  38. command_start.sh
  39. fn_commandname
  40. fi
  41. fi
  42. core_exit.sh