command_dev_details.sh 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. ['Internet IP']="${extip}"
  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 IP']="${ip}"
  54. ['Server Password']="${serverpassword}"
  55. ['Servername']="${servername}"
  56. ['Shard']="${shard}"
  57. ['Sharding']="${sharding}"
  58. ['Steam Auth Port']="${steamauthport}"
  59. ['Telnet Enabled']="${telnetenabled}"
  60. ['Telnet IP']="${telnetip}"
  61. ['Telnet Password']="${telnetpassword}"
  62. ['Telnet Port']="${telnetport}"
  63. ['Tickrate']="${tickrate}"
  64. ['World Name']="${worldname}"
  65. ['World Type']="${worldtype}"
  66. )
  67. # Initialize a variable to keep track of missing server details.
  68. missing_details=""
  69. # Loop through the server details and output them.
  70. echo -e ""
  71. echo -e "${lightgreen}Available Server Details${default}"
  72. echo -e "================================="
  73. for key in "${!server_details[@]}"; do
  74. value=${server_details[$key]}
  75. if [ -z "$value" ]; then
  76. missing_details+="\n${key}"
  77. else
  78. echo -e "$key: $value "
  79. fi
  80. done
  81. # Output the missing server details if there are any.
  82. if [ -n "$missing_details" ]; then
  83. echo -e ""
  84. echo -e "${lightgreen}Missing Server Details${default}"
  85. echo -e "================================="
  86. echo -e "${missing_details}"
  87. fi
  88. core_exit.sh