4
0

command_console.sh 1.3 KB

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