command_details.sh 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751
  1. #!/bin/bash
  2. # LGSM command_details.sh function
  3. # Author: Daniel Gibbs
  4. # Contributor: UltimateByte
  5. # Website: https://gameservermanagers.com
  6. # Description: Displays server information.
  7. local commandname="DETAILS"
  8. local commandaction="Details"
  9. local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  10. # Standard Details
  11. # This applies to all engines
  12. fn_details_os(){
  13. #
  14. # Distro Details
  15. # =====================================
  16. # Distro: Ubuntu 14.04.4 LTS
  17. # Arch: x86_64
  18. # Kernel: 3.13.0-79-generic
  19. # Hostname: hostname
  20. # tmux: tmux 1.8
  21. # GLIBC: 2.19
  22. echo -e ""
  23. echo -e "${lightyellow}Distro Details${default}"
  24. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  25. {
  26. echo -e "${blue}Distro:\t${default}${distroname}"
  27. echo -e "${blue}Arch:\t${default}${arch}"
  28. echo -e "${blue}Kernel:\t${default}${kernel}"
  29. echo -e "${blue}Hostname:\t${default}$HOSTNAME"
  30. echo -e "${blue}tmux:\t${default}${tmuxv}"
  31. echo -e "${blue}GLIBC:\t${default}${glibcversion}"
  32. } | column -s $'\t' -t
  33. }
  34. fn_details_performance(){
  35. #
  36. # Performance
  37. # =====================================
  38. # Uptime: 55d, 3h, 38m
  39. # Avg Load: 1.00, 1.01, 0.78
  40. #
  41. # Mem: total used free cached
  42. # Physical: 741M 656M 85M 256M
  43. # Swap: 0B 0B 0B
  44. echo -e ""
  45. echo -e "${lightyellow}Performance${default}"
  46. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  47. {
  48. echo -e "${blue}Uptime:\t${default}${days}d, ${hours}h, ${minutes}m"
  49. echo -e "${blue}Avg Load:\t${default}${load}"
  50. } | column -s $'\t' -t
  51. echo -e ""
  52. {
  53. echo -e "${blue}Mem:\t${blue}total\t used\t free\t cached${default}"
  54. echo -e "${blue}Physical:\t${default}${physmemtotal}\t${physmemused}\t${physmemfree}\t${physmemcached}${default}"
  55. echo -e "${blue}Swap:\t${default}${swaptotal}\t${swapused}\t${swapfree}${default}"
  56. } | column -s $'\t' -t
  57. }
  58. fn_details_disk(){
  59. #
  60. # Storage
  61. # =====================================
  62. # Filesystem: /dev/disk/by-uuid/320c8edd-a2ce-4a23-8c9d-e00a7af2d6ff
  63. # Total: 15G
  64. # Used: 8.4G
  65. # Available: 5.7G
  66. # LGSM Total: 1G
  67. # Serverfiles: 961M
  68. # Backups: 2G
  69. echo -e ""
  70. echo -e "${lightyellow}Storage${default}"
  71. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  72. {
  73. echo -e "${blue}Filesystem:\t${default}${filesystem}"
  74. echo -e "${blue}Total:\t${default}${totalspace}"
  75. echo -e "${blue}Used:\t${default}${usedspace}"
  76. echo -e "${blue}Available:\t${default}${availspace}"
  77. echo -e "${blue}LGSM Total:\t${default}${rootdirdu}"
  78. echo -e "${blue}Serverfiles:\t${default}${filesdirdu}"
  79. if [ -d "${backupdir}" ]; then
  80. echo -e "${blue}Backups:\t${default}${backupdirdu}"
  81. fi
  82. } | column -s $'\t' -t
  83. }
  84. fn_details_gameserver(){
  85. #
  86. # Quake Live Server Details
  87. # =====================================
  88. # Server name: ql-server
  89. # Server IP: 1.2.3.4:27960
  90. # RCON password: CHANGE_ME
  91. # Server password: NOT SET
  92. # Slots: 16
  93. # Status: OFFLINE
  94. echo -e ""
  95. echo -e "${lightgreen}${gamename} Server Details${default}"
  96. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  97. {
  98. # Server name
  99. if [ -n "${servername}" ]; then
  100. echo -e "${blue}Server name:\t${default}${servername}"
  101. fi
  102. # Server ip
  103. echo -e "${blue}Server IP:\t${default}${ip}:${port}"
  104. # Server password
  105. if [ -n "${serverpassword}" ]; then
  106. echo -e "${blue}Server password:\t${default}${serverpassword}"
  107. fi
  108. # RCON password
  109. if [ -n "${rconpassword}" ]; then
  110. echo -e "${blue}RCON password:\t${default}${rconpassword}"
  111. fi
  112. # Admin password
  113. if [ -n "${adminpassword}" ]; then
  114. echo -e "${blue}Admin password:\t${default}${adminpassword}"
  115. fi
  116. # Stats password (Quake Live)
  117. if [ -n "${statspassword}" ]; then
  118. echo -e "${blue}Stats password:\t${default}${statspassword}"
  119. fi
  120. # Slots
  121. if [ -n "${slots}" ]; then
  122. echo -e "${blue}Slots:\t${default}${slots}"
  123. fi
  124. # Game mode
  125. if [ -n "${gamemode}" ]; then
  126. echo -e "${blue}Game mode:\t${default}${gamemode}"
  127. fi
  128. # Game world
  129. if [ -n "${gameworld}" ]; then
  130. echo -e "${blue}Game world:\t${default}${gameworld}"
  131. fi
  132. # Tick rate
  133. if [ -n "${tickrate}" ]; then
  134. echo -e "${blue}Tick rate:\t${default}${tickrate}"
  135. fi
  136. # TeamSpeak dbplugin
  137. if [ -n "${dbplugin}" ]; then
  138. echo -e "${blue}dbplugin:\t${default}${dbplugin}"
  139. fi
  140. # Online status
  141. if [ "${status}" == "0" ]; then
  142. echo -e "${blue}Status:\t${red}OFFLINE${default}"
  143. else
  144. echo -e "${blue}Status:\t${green}ONLINE${default}"
  145. fi
  146. } | column -s $'\t' -t
  147. echo -e ""
  148. }
  149. fn_details_script(){
  150. #
  151. # qlserver Script Details
  152. # =====================================
  153. # Service name: ql-server
  154. # qlserver version: 150316
  155. # User: lgsm
  156. # Email alert: off
  157. # Update on start: off
  158. # Location: /home/lgsm/qlserver
  159. # Config file: /home/lgsm/qlserver/serverfiles/baseq3/ql-server.cfg
  160. echo -e "${lightgreen}${selfname} Script Details${default}"
  161. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  162. {
  163. # Service name
  164. echo -e "${blue}Service name:\t${default}${servicename}"
  165. # Script version
  166. if [ -n "${version}" ]; then
  167. echo -e "${blue}${selfname} version:\t${default}${version}"
  168. fi
  169. # User
  170. echo -e "${blue}User:\t${default}$(whoami)"
  171. # GLIBC required
  172. if [ -n "${glibcrequired}" ]; then
  173. if [ "${glibcrequired}" == "NOT REQUIRED" ]; then
  174. :
  175. elif [ "${glibcrequired}" == "UNKNOWN" ]; then
  176. echo -e "${blue}GLIBC required:\t${red}${glibcrequired}"
  177. elif [ "$(printf '%s\n'${glibcrequired}'\n' ${glibcversion} | sort -V | head -n 1)" != "${glibcrequired}" ]; then
  178. if [ "${glibcfix}" == "yes" ]; then
  179. echo -e "${blue}GLIBC required:\t${red}${glibcrequired} ${default}(${green}Using GLIBC fix${default})"
  180. else
  181. echo -e "${blue}GLIBC required:\t${red}${glibcrequired} ${default}(${red}GLIBC version too old${default})"
  182. fi
  183. else
  184. echo -e "${blue}GLIBC required:\t${green}${glibcrequired}${default}"
  185. fi
  186. fi
  187. # Email alert
  188. echo -e "${blue}Email alert:\t${default}${emailalert}"
  189. # Pushbullet alert
  190. echo -e "${blue}Pushbullet alert:\t${default}${pushbulletalert}"
  191. # Update on start
  192. if [ -n "${updateonstart}" ]; then
  193. echo -e "${blue}Update on start:\t${default}${updateonstart}"
  194. fi
  195. # Script location
  196. echo -e "${blue}Location:\t${default}${rootdir}"
  197. # Config file location
  198. if [ -n "${servercfgfullpath}" ]; then
  199. if [ -f "${servercfgfullpath}" ]; then
  200. echo -e "${blue}Config file:\t${default}${servercfgfullpath}"
  201. elif [ -d "${servercfgfullpath}" ]; then
  202. echo -e "${blue}Config dir:\t${default}${servercfgfullpath}"
  203. else
  204. echo -e "${blue}Config file:\t${default}${red}${servercfgfullpath}${default} (${red}FILE MISSING${default})"
  205. fi
  206. fi
  207. # Network config file location (ARMA 3)
  208. if [ -n "${networkcfgfullpath}" ]; then
  209. echo -e "${blue}Network config file:\t${default}${networkcfgfullpath}"
  210. fi
  211. } | column -s $'\t' -t
  212. }
  213. fn_details_backup(){
  214. #
  215. # Backups
  216. # =====================================
  217. # No. of backups: 1
  218. # Latest backup:
  219. # date: Fri May 6 18:34:19 UTC 2016
  220. # file: /home/lgsm/qlserver/backups/ql-server-2016-05-06-183239.tar.gz
  221. # size: 945M
  222. echo -e ""
  223. echo -e "${lightgreen}Backups${default}"
  224. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  225. if [ ! -d "${backupdir}" ]||[ "${backupcount}" == "0" ]; then
  226. echo -e "No Backups created"
  227. else
  228. {
  229. echo -e "${blue}No. of backups:\t${default}${backupcount}"
  230. echo -e "${blue}Latest backup:${default}"
  231. if [ "${lastbackupdaysago}" == "0" ]; then
  232. echo -e "${blue} date:\t${default}${lastbackupdate} (less than 1 day ago)"
  233. elif [ "${lastbackupdaysago}" == "1" ]; then
  234. echo -e "${blue} date:\t${default}${lastbackupdate} (1 day ago)"
  235. else
  236. echo -e "${blue} date:\t${default}${lastbackupdate} (${lastbackupdaysago} days ago)"
  237. fi
  238. echo -e "${blue} file:\t${default}${lastbackup}"
  239. echo -e "${blue} size:\t${default}${lastbackupsize}"
  240. } | column -s $'\t' -t
  241. fi
  242. }
  243. fn_details_commandlineparms(){
  244. #
  245. # Command-line Parameters
  246. # =====================================
  247. # ./run_server_x86.sh +set net_strict 1
  248. echo -e ""
  249. echo -e "${lightgreen}Command-line Parameters${default}"
  250. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  251. echo -e "${executable} ${parms}"
  252. }
  253. fn_details_ports(){
  254. # Ports
  255. # =====================================
  256. # Change ports by editing the parameters in:
  257. # /home/lgsm/qlserver/serverfiles/baseq3/ql-server.cfg
  258. echo -e ""
  259. echo -e "${lightgreen}Ports${default}"
  260. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  261. echo -e "Change ports by editing the parameters in:"
  262. parmslocation="${red}UNKNOWN${default}"
  263. # engines that require editing in the config file
  264. local ports_edit_array=( "avalanche" "dontstarve" "idtech2" "idtech3" "idtech3_ql" "lwjgl2" "projectzomboid" "quake" "refractor" "realvirtuality" "seriousengine35" "teeworlds" "terraria" "unreal" "unreal2" "unreal3" "TeamSpeak 3" "Mumble" "7 Days To Die" )
  265. for port_edit in "${ports_edit_array[@]}"
  266. do
  267. if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]; then
  268. parmslocation="${servercfgfullpath}"
  269. fi
  270. done
  271. # engines that require editing in the script file
  272. local ports_edit_array=( "starbound" "spark" "source" "goldsource" "Rust" "Hurtworld" "unreal4")
  273. for port_edit in "${ports_edit_array[@]}"
  274. do
  275. if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]; then
  276. parmslocation="${selfname}"
  277. fi
  278. done
  279. echo -e "${parmslocation}"
  280. echo -e ""
  281. echo -e "Useful port diagnostic command:"
  282. }
  283. fn_details_statusbottom(){
  284. echo -e ""
  285. if [ "${status}" == "0" ]; then
  286. echo -e "${blue}Status:\t${red}OFFLINE${default}"
  287. else
  288. echo -e "${blue}Status:\t${green}ONLINE${default}"
  289. fi
  290. echo -e ""
  291. }
  292. # Engine Specific details
  293. fn_details_avalanche(){
  294. echo -e "netstat -atunp | grep Jcmp-Server"
  295. echo -e ""
  296. {
  297. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  298. echo -e "> Game\tINBOUND\t${port}\tudp"
  299. } | column -s $'\t' -t
  300. }
  301. fn_details_cod(){
  302. echo -e "netstat -atunp | grep cod_lnxded"
  303. echo -e ""
  304. {
  305. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  306. echo -e "> Game\tINBOUND\t${port}\tudp"
  307. } | column -s $'\t' -t
  308. }
  309. fn_details_dontstarve(){
  310. echo -e "netstat -atunp | grep dontstarve"
  311. echo -e ""
  312. {
  313. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  314. echo -e "> Game\tINBOUND\t${port}\tudp"
  315. } | column -s $'\t' -t
  316. }
  317. fn_details_minecraft(){
  318. echo -e "netstat -atunp | grep java"
  319. echo -e ""
  320. {
  321. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  322. echo -e "> Game\tINBOUND\t${port}\tudp"
  323. } | column -s $'\t' -t
  324. }
  325. fn_details_projectzomboid(){
  326. echo -e "netstat -atunp | grep java"
  327. echo -e ""
  328. {
  329. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  330. echo -e "> Game\tINBOUND\t${port}\tudp"
  331. } | column -s $'\t' -t
  332. }
  333. fn_details_realvirtuality(){
  334. echo -e "netstat -atunp | grep arma3server"
  335. echo -e ""
  336. if [ -z "${port}" ]||[ -z "${queryport}" ]||[ -z "${masterport}" ]; then
  337. echo -e "${red}ERROR!${default} Missing/commented ports in ${servercfg}."
  338. echo -e ""
  339. fi
  340. {
  341. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  342. echo -e "> Game\tINBOUND\t${port}\tudp"
  343. echo -e "> Steam: Query\tINBOUND\t${queryport}\tudp"
  344. echo -e "> Steam: Master traffic\tINBOUND\t${masterport}\tudp"
  345. } | column -s $'\t' -t
  346. }
  347. fn_details_refractor(){
  348. echo -e "netstat -atunp | grep bf1942_lnxd"
  349. echo -e ""
  350. {
  351. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  352. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  353. echo -e "> Steam: Query\tINBOUND\t${queryport}\tudp"
  354. } | column -s $'\t' -t
  355. }
  356. fn_details_quake2(){
  357. echo -e "netstat -atunp | grep quake2"
  358. echo -e ""
  359. {
  360. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  361. echo -e "> Game\tINBOUND\t${port}\tudp"
  362. } | column -s $'\t' -t
  363. }
  364. fn_details_quake3(){
  365. echo -e "netstat -atunp | grep q3ded"
  366. echo -e ""
  367. {
  368. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  369. echo -e "> Game\tINBOUND\t${port}\tudp"
  370. } | column -s $'\t' -t
  371. }
  372. fn_details_quake(){
  373. echo -e "netstat -atunp | grep mvdsv"
  374. echo -e ""
  375. {
  376. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  377. echo -e "> Game\tINBOUND\t${port}\tudp"
  378. } | column -s $'\t' -t
  379. }
  380. fn_details_quakelive(){
  381. echo -e "netstat -atunp | grep qzeroded"
  382. echo -e ""
  383. if [ -z "${port}" ]||[ -z "${rconport}" ]||[ -z "${statsport}" ]; then
  384. echo -e "${red}ERROR!${default} Missing/commented ports in ${servercfg}."
  385. echo -e ""
  386. fi
  387. {
  388. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  389. echo -e "> Game\tINBOUND\t${port}\tudp"
  390. echo -e "> Rcon\tINBOUND\t${rconport}\tudp"
  391. echo -e "> Stats\tINBOUND\t${statsport}\tudp"
  392. } | column -s $'\t' -t
  393. }
  394. fn_details_wolfensteinenemyterritory(){
  395. echo -e "netstat -atunp | grep etded"
  396. echo -e ""
  397. {
  398. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  399. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  400. } | column -s $'\t' -t
  401. }
  402. fn_details_seriousengine35(){
  403. echo -e "netstat -atunp | grep Sam3_Dedicate"
  404. echo -e ""
  405. {
  406. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  407. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp"
  408. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  409. } | column -s $'\t' -t
  410. }
  411. fn_details_source(){
  412. echo -e "netstat -atunp | grep srcds_linux"
  413. echo -e ""
  414. {
  415. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  416. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
  417. if [ -n "${sourcetvport}" ]; then
  418. echo -e "> SourceTV\tINBOUND\t${sourcetvport}\tudp"
  419. fi
  420. echo -e "< Client\tOUTBOUND\t${clientport}\tudp"
  421. } | column -s $'\t' -t
  422. }
  423. fn_details_spark(){
  424. echo -e "netstat -atunp | grep server_linux3"
  425. echo -e ""
  426. {
  427. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  428. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  429. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  430. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
  431. } | column -s $'\t' -t
  432. echo -e ""
  433. echo -e "${lightgreen}${servername} WebAdmin${default}"
  434. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  435. {
  436. echo -e "${blue}WebAdmin url:\t${default}http://${ip}:${webadminport}/index.html"
  437. echo -e "${blue}WebAdmin username:\t${default}${webadminuser}"
  438. echo -e "${blue}WebAdmin password:\t${default}${webadminpass}"
  439. } | column -s $'\t' -t
  440. }
  441. fn_details_starbound(){
  442. echo -e "netstat -atunp | grep starbound"
  443. echo -e ""
  444. {
  445. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  446. echo -e "> Game\tINBOUND\t${port}\ttcp"
  447. echo -e "> Query\tINBOUND\t${queryport}\ttcp"
  448. echo -e "> Rcon\tINBOUND\t${rconport}\ttcp"
  449. } | column -s $'\t' -t
  450. }
  451. fn_details_teamspeak3(){
  452. echo -e "netstat -atunp | grep ts3server"
  453. echo -e ""
  454. {
  455. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  456. echo -e "> Voice\tINBOUND\t${port}\tudp"
  457. echo -e "> ServerQuery\tINBOUND\t${queryport}\ttcp"
  458. echo -e "> File transfer\tINBOUND\t${fileport}\ttcp"
  459. } | column -s $'\t' -t
  460. }
  461. fn_details_mumble(){
  462. echo -e "netstat -atunp | grep murmur"
  463. echo -e ""
  464. {
  465. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  466. echo -e "> Voice\tINBOUND\t${port}\tudp"
  467. echo -e "> ServerQuery\tINBOUND\t${port}\ttcp"
  468. } | column -s $'\t' -t
  469. }
  470. fn_details_teeworlds(){
  471. echo -e "netstat -atunp | grep teeworlds_srv"
  472. echo -e ""
  473. {
  474. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  475. echo -e "> Game\tINBOUND\t${port}\ttcp"
  476. } | column -s $'\t' -t
  477. }
  478. fn_details_terraria(){
  479. echo -e "netstat -atunp | grep TerrariaServer"
  480. echo -e ""
  481. {
  482. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  483. echo -e "> Game\tINBOUND\t${port}\ttcp"
  484. } | column -s $'\t' -t
  485. }
  486. fn_details_sdtd(){
  487. echo -e "netstat -atunp | grep 7DaysToDie"
  488. echo -e ""
  489. {
  490. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  491. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  492. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  493. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
  494. echo -e "> Telnet\tINBOUND\t${telnetport}\ttcp"
  495. } | column -s $'\t' -t
  496. echo -e ""
  497. echo -e "${lightgreen}${servername} WebAdmin${default}"
  498. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  499. {
  500. echo -e "${blue}WebAdmin enabled:\t${default}${webadminenabled}"
  501. echo -e "${blue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
  502. echo -e "${blue}WebAdmin password:\t${default}${webadminpass}"
  503. } | column -s $'\t' -t
  504. echo -e ""
  505. echo -e "${lightgreen}${servername} Telnet${default}"
  506. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  507. {
  508. echo -e "${blue}Telnet enabled:\t${default}${telnetenabled}"
  509. echo -e "${blue}Telnet address:\t${default}${ip} ${telnetport}"
  510. echo -e "${blue}Telnet password:\t${default}${telnetpass}"
  511. } | column -s $'\t' -t
  512. }
  513. fn_details_hurtworld(){
  514. echo -e "netstat -atunp | grep Hurtworld"
  515. echo -e ""
  516. {
  517. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  518. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  519. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  520. } | column -s $'\t' -t
  521. }
  522. fn_details_rust(){
  523. echo -e "netstat -atunp | grep Rust"
  524. echo -e ""
  525. {
  526. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  527. echo -e "> Game/Query\tINBOUND\t${port}\ttcp/udp"
  528. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  529. } | column -s $'\t' -t
  530. }
  531. fn_details_unreal(){
  532. echo -e "netstat -atunp | grep ucc-bin"
  533. echo -e ""
  534. {
  535. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL\tINI VARIABLE"
  536. echo -e "> Game\tINBOUND\t${port}\tudp\tPort=${port}"
  537. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  538. if [ "${engine}" == "unreal" ]; then
  539. echo -e "< UdpLink Port (random)\tOUTBOUND\t${udplinkport}+\tudp"
  540. fi
  541. if [ "${engine}" != "unreal" ] && [ "${appid}" != "223250" ]; then
  542. echo -e "> GameSpy query\tINBOUND\t${gsqueryport}\tudp\tOldQueryPortNumber=${gsqueryport}"
  543. fi
  544. if [ "${appid}" == "215360" ]; then
  545. echo -e "< Master server\tOUTBOUND\t28852\ttcp/udp"
  546. else
  547. echo -e "< Master server\tOUTBOUND\t28900/28902\ttcp/udp"
  548. fi
  549. if [ "${appid}" ]; then
  550. if [ "${appid}" == "223250" ]; then
  551. echo -e "< Steam\tOUTBOUND\t20610\tudp"
  552. else
  553. echo -e "< Steam\tOUTBOUND\t20660\tudp"
  554. fi
  555. fi
  556. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp\tListenPort=${webadminport}"
  557. } | column -s $'\t' -t
  558. echo -e ""
  559. echo -e "${lightgreen}${servername} WebAdmin${default}"
  560. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  561. {
  562. echo -e "${blue}WebAdmin enabled:\t${default}${webadminenabled}"
  563. echo -e "${blue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
  564. echo -e "${blue}WebAdmin username:\t${default}${webadminuser}"
  565. echo -e "${blue}WebAdmin password:\t${default}${webadminpass}"
  566. } | column -s $'\t' -t
  567. }
  568. fn_details_ut3(){
  569. echo -e "netstat -atunp | grep ut3-bin"
  570. echo -e ""
  571. {
  572. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  573. echo -e "> Game/Query\tINBOUND\t${port}\ttcp/udp"
  574. } | column -s $'\t' -t
  575. }
  576. fn_details_ark(){
  577. echo -e "netstat -atunp | grep ShooterGame"
  578. echo -e ""
  579. {
  580. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL\tINI VARIABLE"
  581. echo -e "> Game\tINBOUND\t${port}\tudp\tPort=${port}"
  582. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  583. } | column -s $'\t' -t
  584. }
  585. fn_details_cod2(){
  586. echo -e "netstat -atunp | grep cod2_lnxded"
  587. echo -e ""
  588. {
  589. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  590. echo -e "> Game\tINBOUND\t${port}\tudp"
  591. } | column -s $'\t' -t
  592. }
  593. # Run checks and gathers details to display.
  594. fn_display_details() {
  595. check.sh
  596. info_config.sh
  597. info_distro.sh
  598. info_glibc.sh
  599. info_parms.sh
  600. fn_details_os
  601. fn_details_performance
  602. fn_details_disk
  603. fn_details_gameserver
  604. fn_details_script
  605. fn_details_backup
  606. # Some game servers do not have parms.
  607. if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${engine}" != "avalanche" ]&&[ "${engine}" != "dontstarve" ]&&[ "${engine}" != "projectzomboid" ]; then
  608. fn_parms
  609. fn_details_commandlineparms
  610. fi
  611. fn_details_ports
  612. # Display details depending on game or engine.
  613. if [ "${engine}" == "avalanche" ]; then
  614. fn_details_avalanche
  615. elif [ "${engine}" == "refractor" ]; then
  616. fn_details_refractor
  617. elif [ "${engine}" == "dontstarve" ]; then
  618. fn_details_dontstarve
  619. elif [ "${engine}" == "lwjgl2" ]; then
  620. fn_details_minecraft
  621. elif [ "${engine}" == "projectzomboid" ]; then
  622. fn_details_projectzomboid
  623. elif [ "${engine}" == "realvirtuality" ]; then
  624. fn_details_realvirtuality
  625. elif [ "${engine}" == "seriousengine35" ]; then
  626. fn_details_seriousengine35
  627. elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
  628. fn_details_source
  629. elif [ "${engine}" == "spark" ]; then
  630. fn_details_spark
  631. elif [ "${engine}" == "starbound" ]; then
  632. fn_details_starbound
  633. elif [ "${engine}" == "teeworlds" ]; then
  634. fn_details_teeworlds
  635. elif [ "${engine}" == "terraria" ]; then
  636. fn_details_terraria
  637. elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
  638. fn_details_unreal
  639. elif [ "${engine}" == "unreal3" ]; then
  640. fn_details_ut3
  641. elif [ "${gamename}" == "7 Days To Die" ]; then
  642. fn_details_sdtd
  643. elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
  644. fn_details_ark
  645. elif [ "${gamename}" == "Call of Duty" ]; then
  646. fn_details_cod
  647. elif [ "${gamename}" == "Call of Duty 2" ]; then
  648. fn_details_cod2
  649. elif [ "${gamename}" == "Hurtworld" ]; then
  650. fn_details_hurtworld
  651. elif [ "${gamename}" == "QuakeWorld" ]; then
  652. fn_details_quake
  653. elif [ "${gamename}" == "Quake 2" ]; then
  654. fn_details_quake2
  655. elif [ "${gamename}" == "Quake 3: Arena" ]; then
  656. fn_details_quake3
  657. elif [ "${gamename}" == "Quake Live" ]; then
  658. fn_details_quakelive
  659. elif [ "${gamename}" == "TeamSpeak 3" ]; then
  660. fn_details_teamspeak3
  661. elif [ "${gamename}" == "Mumble" ]; then
  662. fn_details_mumble
  663. elif [ "${gamename}" == "Rust" ]; then
  664. fn_details_rust
  665. elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
  666. fn_details_wolfensteinenemyterritory
  667. else
  668. fn_print_error_nl "Unable to detect server engine."
  669. fi
  670. fn_details_statusbottom
  671. }
  672. if [ -z "${postdetails}" ] ;
  673. then
  674. fn_display_details
  675. core_exit.sh
  676. fi