4
0

command_console.sh 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. done
  18. fn_print_dots "Accessing console"
  19. sleep 1
  20. check_status.sh
  21. if [ "${status}" != "0" ]; then
  22. fn_print_ok_nl "Accessing console"
  23. fn_script_log_pass "Console accessed"
  24. sleep 1
  25. tmux attach-session -t ${servicename}
  26. fn_print_ok_nl "Closing console"
  27. fn_script_log_pass "Console closed"
  28. else
  29. fn_print_error_nl "Server not running"
  30. fn_script_log_error "Failed to access: Server not running"
  31. sleep 1
  32. if fn_prompt_yn "Do you want to start the server?" Y; then
  33. exitbypass=1; command_start.sh
  34. fi
  35. fi
  36. core_exit.sh