command_debug.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/bash
  2. # LGSM command_debug.sh function
  3. # Author: Daniel Gibbs
  4. # Website: https://gameservermanagers.com
  5. lgsm_version="210516"
  6. # Description: Runs the server without tmux. Runs direct from the terminal.
  7. local modulename="Debug"
  8. function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  9. # Trap to remove lockfile on quit.
  10. fn_lockfile_trap(){
  11. # Remove lock file
  12. rm -f "${rootdir}/${lockselfname}"
  13. core_exit.sh
  14. }
  15. check.sh
  16. fix.sh
  17. info_distro.sh
  18. # NOTE: Check if works with server without parms. Could be intergrated in to info_parms.sh
  19. fn_parms
  20. echo ""
  21. echo "${gamename} Debug"
  22. echo "================================="
  23. echo ""
  24. echo -e "Distro: ${os}"
  25. echo -e "Arch: ${arch}"
  26. echo -e "Kernel: ${kernel}"
  27. echo -e "Hostname: $HOSTNAME"
  28. echo ""
  29. echo "Start parameters:"
  30. if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
  31. echo "${executable} ${parms} -debug"
  32. else
  33. echo "${executable} ${parms}"
  34. fi
  35. echo ""
  36. echo -e "Use for identifying server issues only!"
  37. echo -e "Press CTRL+c to drop out of debug mode."
  38. fn_print_warning_nl "If ${servicename} is already running it will be stopped."
  39. echo ""
  40. while true; do
  41. read -e -i "y" -p "Continue? [Y/n]" yn
  42. case $yn in
  43. [Yy]* ) break;;
  44. [Nn]* ) echo Exiting; return;;
  45. * ) echo "Please answer yes or no.";;
  46. esac
  47. done
  48. fn_print_info_nl "Stopping any running servers"
  49. fn_script_log_info "Stopping any running servers"
  50. sleep 1
  51. command_stop.sh
  52. fn_print_dots "Starting debug"
  53. fn_script_log_info "Starting debug"
  54. sleep 1
  55. fn_print_ok_nl "Starting debug"
  56. # create lock file.
  57. date > "${rootdir}/${lockselfname}"
  58. # trap to remove lockfile on quit.
  59. trap fn_lockfile_trap INT
  60. cd "${executabledir}"
  61. if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
  62. ${executable} ${parms} -debug
  63. else
  64. ${executable} ${parms}
  65. fi
  66. # remove trap.
  67. trap - INT
  68. core_exit.sh