command_console.sh 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. # LinuxGSM command_console.sh function
  3. # Author: Daniel Gibbs
  4. # Website: https://gameservermanagers.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. fn_print_information_nl "Press \"CTRL+b\" then \"d\" to exit console."
  12. fn_print_warning_nl "Do NOT press CTRL+c to exit."
  13. echo ""
  14. if ! fn_prompt_yn "Continue?" Y; then
  15. echo Exiting; return
  16. fi
  17. fn_print_dots "Accessing console"
  18. sleep 1
  19. check_status.sh
  20. if [ "${status}" != "0" ]; then
  21. fn_print_ok_nl "Accessing console"
  22. fn_script_log_pass "Console accessed"
  23. sleep 1
  24. tmux attach-session -t ${servicename}
  25. fn_print_ok_nl "Closing console"
  26. fn_script_log_pass "Console closed"
  27. else
  28. fn_print_error_nl "Server not running"
  29. fn_script_log_error "Failed to access: Server not running"
  30. sleep 1
  31. if fn_prompt_yn "Do you want to start the server?" Y; then
  32. exitbypass=1; command_start.sh
  33. fi
  34. fi
  35. core_exit.sh