command_dev_details.sh 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #!/bin/bash
  2. # LinuxGSM command_dev_debug.sh module
  3. # Author: Daniel Gibbs
  4. # Contributors: http://linuxgsm.com/contrib
  5. # Website: https://linuxgsm.com
  6. # Description: Dev only: Enables debugging log to be saved to dev-debug.log.
  7. if [ -f "config" ]; then
  8. servercfgfullpath="config"
  9. fi
  10. if [ -f "clusterconfig" ]; then
  11. clustercfgfullpath="clusterconfig"
  12. fi
  13. info_game.sh
  14. carriagereturn=$(file -b "${servercfgfullpath}" | grep -q CRLF && echo "${red}CRLF${default}" || echo "${lightgreen}LF${default}")
  15. echo -e ""
  16. echo -e "${lightgreen}Server Details${default}"
  17. echo -e "=================================================================="
  18. echo -e ""
  19. echo -e "Game: ${gamename}"
  20. echo -e "Config type: ${configtype}"
  21. echo -e "Config file: ${servercfgfullpath}"
  22. if [ -f "${clustercfgfullpath}" ]; then
  23. echo -e "Cluster config file: ${clustercfgfullpath}"
  24. fi
  25. echo -e "Carriage Return: ${carriagereturn}"
  26. # Create an associative array of the server details.
  27. declare -A server_details=(
  28. ['Admin Password']="${adminpassword}"
  29. ['API Port']="${apiport}"
  30. ['Cave']="${cave}"
  31. ['Cluster']="${cluster}"
  32. ['Config IP']="${configip}"
  33. ['Default Map']="${defaultmap}"
  34. ['Game Mode']="${gamemode}"
  35. ['Game Type']="${gametype}"
  36. ['HTTP Enabled']="${httpenabled}"
  37. ['HTTP IP']="${httpip}"
  38. ['HTTP Password']="${httppassword}"
  39. ['HTTP Port']="${httpport}"
  40. ['HTTP User']="${httpuser}"
  41. ['ip']="${ip}"
  42. ['LAN Port']="${lanport}"
  43. ['Master Port']="${masterport}"
  44. ['Master']="${master}"
  45. ['Maxplayers']="${maxplayers}"
  46. ['OldQueryPortNumber']="${oldqueryportnumber}"
  47. ['Port']="${port}"
  48. ['Query Port']="${queryport}"
  49. ['RCON Enabled']="${rconenabled}"
  50. ['RCON Password']="${rconpassword}"
  51. ['RCON Port']="${rconport}"
  52. ['Reserved Slots']="${reservedslots}"
  53. ['Server Password']="${serverpassword}"
  54. ['Servername']="${servername}"
  55. ['Shard']="${shard}"
  56. ['Sharding']="${sharding}"
  57. ['Steam Auth Port']="${steamauthport}"
  58. ['Telnet IP']="${telnetip}"
  59. ['Tickrate']="${tickrate}"
  60. ['World Name']="${worldname}"
  61. ['World Type']="${worldtype}"
  62. )
  63. # Initialize a variable to keep track of missing server details.
  64. missing_details=""
  65. # Loop through the server details and output them.
  66. echo -e ""
  67. echo -e "${lightgreen}Available Server Details${default}"
  68. echo -e "================================="
  69. for key in "${!server_details[@]}"; do
  70. value=${server_details[$key]}
  71. if [ -z "$value" ]; then
  72. missing_details+="\n${key}"
  73. else
  74. echo -e "$key: $value "
  75. fi
  76. done
  77. # Output the missing server details if there are any.
  78. if [ -n "$missing_details" ]; then
  79. echo -e ""
  80. echo -e "${lightgreen}Missing Server Details${default}"
  81. echo -e "================================="
  82. echo -e "${missing_details}"
  83. fi
  84. core_exit.sh