4
0

command_dev_parse_distro_details.sh 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #!/bin/bash
  2. # LinuxGSM command_dev_parse_distro_details.sh module
  3. # Author: Daniel Gibbs
  4. # Contributors: https://linuxgsm.com/contrib
  5. # Website: https://linuxgsm.com
  6. # Description: Display parsed distro details.
  7. check_ip.sh
  8. check_status.sh
  9. info_distro.sh
  10. # Create an associative array of the server details.
  11. declare -A server_details=(
  12. ['.NET Version']="${dotnetversion}"
  13. ['Arch']="${arch}"
  14. ['Backup Count']="${backupcount}"
  15. ['Backup Last Date']="${lastbackupdate}"
  16. ['Backup Last Days Ago']="${lastbackupdaysago}"
  17. ['Backup Last Size']="${lastbackupsize}"
  18. ['Backup Last']="${lastbackup}"
  19. ['CPU Average Load']="${load}"
  20. ['CPU Cores']="${cpucores}"
  21. ['CPU Frequency']="${cpufreqency}"
  22. ['CPU Model']="${cpumodel}"
  23. ['Distro Codename']="${distrocodename}"
  24. ['Distro ID Like']="${distroidlike}"
  25. ['Distro ID']="${distroid}"
  26. ['Distro Kernel']="${kernel}"
  27. ['Distro Name']="${distroname}"
  28. ['Distro Version CSV']="${distroversioncsv}"
  29. ['Distro Version RH']="${distroversionrh}"
  30. ['Distro Version']="${distroversion}"
  31. ['Distro-Info Support']="${distrosupport}"
  32. ['File System']="${filesystem}"
  33. ['Game Server PID']="${gameserverpid}"
  34. ['Gameserver CPU Used MHz']="${cpuusedmhz}"
  35. ['Gameserver CPU Used']="${cpuused}"
  36. ['Gameserver Mem Used MB']="${memusedmb}"
  37. ['Gameserver Mem Used Pct']="${memusedpct}"
  38. ['GLIBC Version']="${glibcversion}"
  39. ['GLIBC']="${glibc}"
  40. ['HLDS Linux PID']="${hldslinuxpid}"
  41. ['Java Version']="${javaversion}"
  42. ['Mono Version']="${monoversion}"
  43. ['Network Interface']="${netint}"
  44. ['Network Link Speed']="${netlink}"
  45. ['Old Free']="${oldfree}"
  46. ['Phys Mem Available']="${physmemavailable}"
  47. ['Phys Mem Buffers KB']="${physmembufferskb}"
  48. ['Phys Mem Cached']="${physmemcached}"
  49. ['Phys Mem Free']="${physmemfree}"
  50. ['Phys Mem Reclaimable KB']="${physmemreclaimablekb}"
  51. ['Phys Mem Total GB']="${physmemtotalgb}"
  52. ['Phys Mem Used']="${physmemused}"
  53. ['Size Backup Dir']="${backupdirdu}"
  54. ['Size Root Dir ']="${rootdirdu}"
  55. ['Size Root Dir Excl. Backup']="${rootdirduexbackup}"
  56. ['Size Serverfiles']="${serverfilesdu}"
  57. ['SRCDS Linux PID']="${srcdslinuxpid}"
  58. ['Storage Available']="${availspace}"
  59. ['Storage Total']="${totalspace}"
  60. ['Storage Used']="${usedspace}"
  61. ['Swap Free']="${swapfree}"
  62. ['Swap Total']="${swaptotal}"
  63. ['Swap Used']="${swapused}"
  64. ['Tmux Version']="${tmuxversion}"
  65. ['Uptime Days']="${days}"
  66. ['Uptime Hours']="${hours}"
  67. ['Uptime Minutes']="${minutes}"
  68. ['Uptime Total Seconds']="${uptime}"
  69. ['Virtual Environment']="${virtualenvironment}"
  70. # ['Distro Info Array']="${distro_info_array}"
  71. # ['Distros Unsupported Array']="${distrosunsupported_array}"
  72. # ['Distros Unsupported']="${distrosunsupported}"
  73. # ['Human Readable']="${humanreadable}"
  74. # ['Phys Mem Actual Free KB']="${physmemactualfreekb}"
  75. # ['Phys Mem Cached KB']="${physmemcachedkb}"
  76. # ['Phys Mem Free KB']="${physmemfreekb}"
  77. # ['Phys Mem Total KB']="${physmemtotalkb}"
  78. # ['Phys Mem Total MB']="${physmemtotalmb}"
  79. # ['SS Info']="${ssinfo}"
  80. )
  81. # Initialize variables to keep track of available and missing distro details.
  82. available_details=""
  83. missing_details=""
  84. # Loop through the distro details and store them.
  85. for key in "${!server_details[@]}"; do
  86. value=${server_details[$key]}
  87. if [ -n "$value" ]; then
  88. available_details+="${lightblue}${key}: ${default}${value}\n"
  89. else
  90. missing_details+="${key}\n"
  91. fi
  92. done
  93. # Sort and output the available distro details.
  94. if [ -n "$available_details" ]; then
  95. echo -e ""
  96. echo -e "${bold}${lightgreen}Available Distro Details${default}"
  97. fn_messages_separator
  98. echo -e "${available_details}" | sort
  99. fi
  100. # Sort and output the missing distro details.
  101. if [ -n "$missing_details" ]; then
  102. echo -e ""
  103. echo -e "${lightgreen}Missing or unsupported Distro Details${default}"
  104. fn_messages_separator
  105. echo -e "${missing_details}" | sort
  106. fi
  107. core_exit.sh