command_dev_parse_distro_details.sh 4.1 KB

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