command_dev_parse_distro_details.sh 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 Frequency']="${cpufreqency}"
  27. ['CPU Model']="${cpumodel}"
  28. ['Distro Codename']="${distrocodename}"
  29. ['Distro ID Like']="${distroidlike}"
  30. ['Distro ID']="${distroid}"
  31. ['Distro Kernel']="${kernel}"
  32. ['Distro Name']="${distroname}"
  33. ['Distro Version CSV']="${distroversioncsv}"
  34. ['Distro Version RH']="${distroversionrh}"
  35. ['Distro Version']="${distroversion}"
  36. ['Distro-Info Support']="${distrosupport}"
  37. ['File System']="${filesystem}"
  38. ['Game Server PID']="${gameserverpid}"
  39. ['Gameserver CPU Used MHz']="${cpuusedmhz}"
  40. ['Gameserver CPU Used']="${cpuused}"
  41. ['Gameserver Mem Used MB']="${memusedmb}"
  42. ['Gameserver Mem Used Pct']="${memusedpct}"
  43. ['GLIBC Version']="${glibcversion}"
  44. ['GLIBC']="${glibc}"
  45. ['HLDS Linux PID']="${hldslinuxpid}"
  46. ['Java Version']="${javaversion}"
  47. ['Mono Version']="${monoversion}"
  48. ['Network Interface']="${netint}"
  49. ['Network Link Speed']="${netlink}"
  50. ['Old Free']="${oldfree}"
  51. ['Phys Mem Available']="${physmemavailable}"
  52. ['Phys Mem Buffers KB']="${physmembufferskb}"
  53. ['Phys Mem Cached']="${physmemcached}"
  54. ['Phys Mem Free']="${physmemfree}"
  55. ['Phys Mem Reclaimable KB']="${physmemreclaimablekb}"
  56. ['Phys Mem Total GB']="${physmemtotalgb}"
  57. ['Phys Mem Used']="${physmemused}"
  58. ['Size Backup Dir']="${backupdirdu}"
  59. ['Size Root Dir ']="${rootdirdu}"
  60. ['Size Root Dir Excl. Backup']="${rootdirduexbackup}"
  61. ['Size Serverfiles']="${serverfilesdu}"
  62. ['SRCDS Linux PID']="${srcdslinuxpid}"
  63. ['Storage Available']="${availspace}"
  64. ['Storage Total']="${totalspace}"
  65. ['Storage Used']="${usedspace}"
  66. ['Swap Free']="${swapfree}"
  67. ['Swap Total']="${swaptotal}"
  68. ['Swap Used']="${swapused}"
  69. ['Tmux Version']="${tmuxversion}"
  70. ['Uptime Days']="${days}"
  71. ['Uptime Hours']="${hours}"
  72. ['Uptime Minutes']="${minutes}"
  73. ['Uptime Total Seconds']="${uptime}"
  74. ['Virtual Environment']="${virtualenvironment}"
  75. # ['Distro Info Array']="${distro_info_array}"
  76. # ['Distros Unsupported Array']="${distrosunsupported_array}"
  77. # ['Distros Unsupported']="${distrosunsupported}"
  78. # ['Human Readable']="${humanreadable}"
  79. # ['Phys Mem Actual Free KB']="${physmemactualfreekb}"
  80. # ['Phys Mem Cached KB']="${physmemcachedkb}"
  81. # ['Phys Mem Free KB']="${physmemfreekb}"
  82. # ['Phys Mem Total KB']="${physmemtotalkb}"
  83. # ['Phys Mem Total MB']="${physmemtotalmb}"
  84. # ['SS Info']="${ssinfo}"
  85. )
  86. # Initialize variables to keep track of available and missing distro details.
  87. available_details=""
  88. missing_details=""
  89. # Loop through the distro details and store them.
  90. for key in "${!server_details[@]}"; do
  91. value=${server_details[$key]}
  92. if [ -n "$value" ]; then
  93. available_details+="${lightblue}${key}: ${default}${value}\n"
  94. else
  95. missing_details+="${key}\n"
  96. fi
  97. done
  98. # Sort and output the available distro details.
  99. if [ -n "$available_details" ]; then
  100. echo -e ""
  101. echo -e "${bold}${lightgreen}Available Distro Details${default}"
  102. fn_messages_separator
  103. echo -e "${available_details}" | sort
  104. fi
  105. # Sort and output the missing distro details.
  106. if [ -n "$missing_details" ]; then
  107. echo -e ""
  108. echo -e "${lightgreen}Missing or unsupported Distro Details${default}"
  109. fn_messages_separator
  110. echo -e "${missing_details}" | sort
  111. fi
  112. core_exit.sh