command_console.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. local commandname="CONSOLE"
  7. local commandaction="Console"
  8. local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
  9. check.sh
  10. fn_print_header
  11. if [ "${shortname}" == "rust" ]||[ "${shortname}" == "hw" ]||[ "${shortname}" == "ark" ]; then
  12. fn_print_information_nl "${gamename} does not produce a verbose output to the console"
  13. fn_print_information_nl "${gamename} does not allow server commands to be entered in to the console"
  14. fi
  15. fn_print_information_nl "Press \"CTRL+b\" then \"d\" to exit console."
  16. fn_print_warning_nl "Do NOT press CTRL+c to exit."
  17. echo -e " * https://docs.linuxgsm.com/commands/console"
  18. echo -e ""
  19. if ! fn_prompt_yn "Continue?" Y; then
  20. return
  21. fi
  22. fn_print_dots "Accessing console"
  23. check_status.sh
  24. if [ "${status}" != "0" ]; then
  25. fn_print_ok_nl "Accessing console"
  26. fn_script_log_pass "Console accessed"
  27. tmux attach-session -t "${selfname}"
  28. fn_print_ok_nl "Closing console"
  29. fn_script_log_pass "Console closed"
  30. else
  31. fn_print_error_nl "Server not running"
  32. fn_script_log_error "Failed to access: Server not running"
  33. if fn_prompt_yn "Do you want to start the server?" Y; then
  34. exitbypass=1
  35. command_start.sh
  36. fi
  37. fi
  38. core_exit.sh