command_details.sh 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819
  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. # Maxplayers: 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. # Maxplayers
  121. if [ -n "${maxplayers}" ]; then
  122. echo -e "${blue}Maxplayers:\t${default}${maxplayers}"
  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. # Cluster (Don't Starve Together)
  137. if [ -n "${cluster}" ]; then
  138. echo -e "${blue}Cluster:\t${default}${cluster}"
  139. fi
  140. # Shard (Don't Starve Together)
  141. if [ -n "${shard}" ]; then
  142. echo -e "${blue}Shard:\t${default}${shard}"
  143. fi
  144. # TeamSpeak dbplugin
  145. if [ -n "${dbplugin}" ]; then
  146. echo -e "${blue}dbplugin:\t${default}${dbplugin}"
  147. fi
  148. # Online status
  149. if [ "${status}" == "0" ]; then
  150. echo -e "${blue}Status:\t${red}OFFLINE${default}"
  151. else
  152. echo -e "${blue}Status:\t${green}ONLINE${default}"
  153. fi
  154. } | column -s $'\t' -t
  155. echo -e ""
  156. }
  157. fn_details_script(){
  158. #
  159. # qlserver Script Details
  160. # =====================================
  161. # Service name: ql-server
  162. # qlserver version: 150316
  163. # User: lgsm
  164. # Email alert: off
  165. # Update on start: off
  166. # Location: /home/lgsm/qlserver
  167. # Config file: /home/lgsm/qlserver/serverfiles/baseq3/ql-server.cfg
  168. echo -e "${lightgreen}${selfname} Script Details${default}"
  169. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  170. {
  171. # Service name
  172. echo -e "${blue}Service name:\t${default}${servicename}"
  173. # Script version
  174. if [ -n "${version}" ]; then
  175. echo -e "${blue}${selfname} version:\t${default}${version}"
  176. fi
  177. # User
  178. echo -e "${blue}User:\t${default}$(whoami)"
  179. # GLIBC required
  180. if [ -n "${glibcrequired}" ]; then
  181. if [ "${glibcrequired}" == "NOT REQUIRED" ]; then
  182. :
  183. elif [ "${glibcrequired}" == "UNKNOWN" ]; then
  184. echo -e "${blue}GLIBC required:\t${red}${glibcrequired}"
  185. elif [ "$(printf '%s\n'${glibcrequired}'\n' ${glibcversion} | sort -V | head -n 1)" != "${glibcrequired}" ]; then
  186. if [ "${glibcfix}" == "yes" ]; then
  187. echo -e "${blue}GLIBC required:\t${red}${glibcrequired} ${default}(${green}Using GLIBC fix${default})"
  188. else
  189. echo -e "${blue}GLIBC required:\t${red}${glibcrequired} ${default}(${red}GLIBC version too old${default})"
  190. fi
  191. else
  192. echo -e "${blue}GLIBC required:\t${green}${glibcrequired}${default}"
  193. fi
  194. fi
  195. # Email alert
  196. echo -e "${blue}Email alert:\t${default}${emailalert}"
  197. # Pushbullet alert
  198. echo -e "${blue}Pushbullet alert:\t${default}${pushbulletalert}"
  199. # Update on start
  200. if [ -n "${updateonstart}" ]; then
  201. echo -e "${blue}Update on start:\t${default}${updateonstart}"
  202. fi
  203. # Script location
  204. echo -e "${blue}Location:\t${default}${rootdir}"
  205. # Config file location
  206. if [ -n "${servercfgfullpath}" ]; then
  207. if [ -f "${servercfgfullpath}" ]; then
  208. echo -e "${blue}Config file:\t${default}${servercfgfullpath}"
  209. elif [ -d "${servercfgfullpath}" ]; then
  210. echo -e "${blue}Config dir:\t${default}${servercfgfullpath}"
  211. else
  212. echo -e "${blue}Config file:\t${default}${red}${servercfgfullpath}${default} (${red}FILE MISSING${default})"
  213. fi
  214. fi
  215. # Network config file location (ARMA 3)
  216. if [ -n "${networkcfgfullpath}" ]; then
  217. echo -e "${blue}Network config file:\t${default}${networkcfgfullpath}"
  218. fi
  219. } | column -s $'\t' -t
  220. }
  221. fn_details_backup(){
  222. #
  223. # Backups
  224. # =====================================
  225. # No. of backups: 1
  226. # Latest backup:
  227. # date: Fri May 6 18:34:19 UTC 2016
  228. # file: /home/lgsm/qlserver/backups/ql-server-2016-05-06-183239.tar.gz
  229. # size: 945M
  230. echo -e ""
  231. echo -e "${lightgreen}Backups${default}"
  232. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  233. if [ ! -d "${backupdir}" ]||[ "${backupcount}" == "0" ]; then
  234. echo -e "No Backups created"
  235. else
  236. {
  237. echo -e "${blue}No. of backups:\t${default}${backupcount}"
  238. echo -e "${blue}Latest backup:${default}"
  239. if [ "${lastbackupdaysago}" == "0" ]; then
  240. echo -e "${blue} date:\t${default}${lastbackupdate} (less than 1 day ago)"
  241. elif [ "${lastbackupdaysago}" == "1" ]; then
  242. echo -e "${blue} date:\t${default}${lastbackupdate} (1 day ago)"
  243. else
  244. echo -e "${blue} date:\t${default}${lastbackupdate} (${lastbackupdaysago} days ago)"
  245. fi
  246. echo -e "${blue} file:\t${default}${lastbackup}"
  247. echo -e "${blue} size:\t${default}${lastbackupsize}"
  248. } | column -s $'\t' -t
  249. fi
  250. }
  251. fn_details_commandlineparms(){
  252. #
  253. # Command-line Parameters
  254. # =====================================
  255. # ./run_server_x86.sh +set net_strict 1
  256. echo -e ""
  257. echo -e "${lightgreen}Command-line Parameters${default}"
  258. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  259. echo -e "${executable} ${parms}"
  260. }
  261. fn_details_ports(){
  262. # Ports
  263. # =====================================
  264. # Change ports by editing the parameters in:
  265. # /home/lgsm/qlserver/serverfiles/baseq3/ql-server.cfg
  266. echo -e ""
  267. echo -e "${lightgreen}Ports${default}"
  268. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  269. echo -e "Change ports by editing the parameters in:"
  270. parmslocation="${red}UNKNOWN${default}"
  271. # engines/games that require editing in the config file
  272. 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" )
  273. for port_edit in "${ports_edit_array[@]}"
  274. do
  275. if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]; then
  276. parmslocation="${servercfgfullpath}"
  277. fi
  278. done
  279. # engines/games that require editing in the script file
  280. local ports_edit_array=( "goldsource" "Factorio" "Hurtworld" "iw3.0" "Rust" "spark" "source" "starbound" "unreal4" )
  281. for port_edit in "${ports_edit_array[@]}"
  282. do
  283. if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]; then
  284. parmslocation="${selfname}"
  285. fi
  286. done
  287. echo -e "${parmslocation}"
  288. echo -e ""
  289. echo -e "Useful port diagnostic command:"
  290. }
  291. fn_details_statusbottom(){
  292. echo -e ""
  293. if [ "${status}" == "0" ]; then
  294. echo -e "${blue}Status:\t${red}OFFLINE${default}"
  295. else
  296. echo -e "${blue}Status:\t${green}ONLINE${default}"
  297. fi
  298. echo -e ""
  299. }
  300. # Engine Specific details
  301. fn_details_ark(){
  302. echo -e "netstat -atunp | grep ShooterGame"
  303. echo -e ""
  304. {
  305. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL\tINI VARIABLE"
  306. echo -e "> Game\tINBOUND\t${port}\tudp\tPort=${port}"
  307. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  308. } | column -s $'\t' -t
  309. }
  310. fn_details_avalanche(){
  311. echo -e "netstat -atunp | grep Jcmp-Server"
  312. echo -e ""
  313. {
  314. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  315. echo -e "> Game\tINBOUND\t${port}\tudp"
  316. } | column -s $'\t' -t
  317. }
  318. fn_details_cod(){
  319. echo -e "netstat -atunp | grep cod_lnxded"
  320. echo -e ""
  321. {
  322. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  323. echo -e "> Game\tINBOUND\t${port}\tudp"
  324. } | column -s $'\t' -t
  325. }
  326. fn_details_coduo(){
  327. echo -e "netstat -atunp | grep coduo_lnxded"
  328. echo -e ""
  329. {
  330. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  331. echo -e "> Game\tINBOUND\t${port}\tudp"
  332. } | column -s $'\t' -t
  333. }
  334. fn_details_cod2(){
  335. echo -e "netstat -atunp | grep cod2_lnxded"
  336. echo -e ""
  337. {
  338. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  339. echo -e "> Game\tINBOUND\t${port}\tudp"
  340. } | column -s $'\t' -t
  341. }
  342. fn_details_cod4(){
  343. echo -e "netstat -atunp"
  344. echo -e ""
  345. {
  346. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  347. echo -e "> Game\tINBOUND\t${port}\tudp"
  348. } | column -s $'\t' -t
  349. }
  350. fn_details_codwaw(){
  351. echo -e "netstat -atunp | grep codwaw_lnxded"
  352. echo -e ""
  353. {
  354. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  355. echo -e "> Game\tINBOUND\t${port}\tudp"
  356. } | column -s $'\t' -t
  357. }
  358. fn_details_dontstarve(){
  359. echo -e "netstat -atunp | grep dontstarve"
  360. echo -e ""
  361. {
  362. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  363. echo -e "> Game: Server\tINBOUND\t${port}\tudp"
  364. echo -e "> Game: Master\tINBOUND\t${masterport}\tudp"
  365. echo -e "> Steam: Auth\tINBOUND\t${steamauthenticationport}\tudp"
  366. echo -e "> Steam: Master\tINBOUND\t${steammasterserverport}\tudp"
  367. } | column -s $'\t' -t
  368. }
  369. fn_details_factorio(){
  370. echo -e "netstat -atunp | grep factorio"
  371. echo -e ""
  372. {
  373. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  374. echo -e "> Game\tINBOUND\t${port}\ttcp"
  375. } | column -s $'\t' -t
  376. }
  377. fn_details_goldsource(){
  378. echo -e "netstat -atunp | grep hlds_linux"
  379. echo -e ""
  380. {
  381. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  382. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
  383. echo -e "< Client\tOUTBOUND\t${clientport}\tudp"
  384. } | column -s $'\t' -t
  385. }
  386. fn_details_hurtworld(){
  387. echo -e "netstat -atunp | grep Hurtworld"
  388. echo -e ""
  389. {
  390. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  391. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  392. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  393. } | column -s $'\t' -t
  394. }
  395. fn_details_minecraft(){
  396. echo -e "netstat -atunp | grep java"
  397. echo -e ""
  398. {
  399. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  400. echo -e "> Game\tINBOUND\t${port}\tudp"
  401. } | column -s $'\t' -t
  402. }
  403. fn_details_mumble(){
  404. echo -e "netstat -atunp | grep murmur"
  405. echo -e ""
  406. {
  407. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  408. echo -e "> Voice\tINBOUND\t${port}\tudp"
  409. echo -e "> ServerQuery\tINBOUND\t${port}\ttcp"
  410. } | column -s $'\t' -t
  411. }
  412. fn_details_projectzomboid(){
  413. echo -e "netstat -atunp | grep java"
  414. echo -e ""
  415. {
  416. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  417. echo -e "> Game\tINBOUND\t${port}\tudp"
  418. } | column -s $'\t' -t
  419. }
  420. fn_details_quake(){
  421. echo -e "netstat -atunp | grep mvdsv"
  422. echo -e ""
  423. {
  424. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  425. echo -e "> Game\tINBOUND\t${port}\tudp"
  426. } | column -s $'\t' -t
  427. }
  428. fn_details_quake2(){
  429. echo -e "netstat -atunp | grep quake2"
  430. echo -e ""
  431. {
  432. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  433. echo -e "> Game\tINBOUND\t${port}\tudp"
  434. } | column -s $'\t' -t
  435. }
  436. fn_details_quake3(){
  437. echo -e "netstat -atunp | grep q3ded"
  438. echo -e ""
  439. {
  440. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  441. echo -e "> Game\tINBOUND\t${port}\tudp"
  442. } | column -s $'\t' -t
  443. }
  444. fn_details_quakelive(){
  445. echo -e "netstat -atunp | grep qzeroded"
  446. echo -e ""
  447. if [ -z "${port}" ]||[ -z "${rconport}" ]||[ -z "${statsport}" ]; then
  448. echo -e "${red}ERROR!${default} Missing/commented ports in ${servercfg}."
  449. echo -e ""
  450. fi
  451. {
  452. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  453. echo -e "> Game\tINBOUND\t${port}\tudp"
  454. echo -e "> Rcon\tINBOUND\t${rconport}\tudp"
  455. echo -e "> Stats\tINBOUND\t${statsport}\tudp"
  456. } | column -s $'\t' -t
  457. }
  458. fn_details_realvirtuality(){
  459. echo -e "netstat -atunp | grep arma3server"
  460. echo -e ""
  461. if [ -z "${port}" ]||[ -z "${queryport}" ]||[ -z "${masterport}" ]; then
  462. echo -e "${red}ERROR!${default} Missing/commented ports in ${servercfg}."
  463. echo -e ""
  464. fi
  465. {
  466. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  467. echo -e "> Game\tINBOUND\t${port}\tudp"
  468. echo -e "> Steam: Query\tINBOUND\t${queryport}\tudp"
  469. echo -e "> Steam: Master traffic\tINBOUND\t${masterport}\tudp"
  470. } | column -s $'\t' -t
  471. }
  472. fn_details_refractor(){
  473. echo -e "netstat -atunp | grep bf1942_lnxd"
  474. echo -e ""
  475. {
  476. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  477. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  478. echo -e "> Steam: Query\tINBOUND\t${queryport}\tudp"
  479. } | column -s $'\t' -t
  480. }
  481. fn_details_rust(){
  482. echo -e "netstat -atunp | grep Rust"
  483. echo -e ""
  484. {
  485. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  486. echo -e "> Game/Query\tINBOUND\t${port}\ttcp/udp"
  487. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  488. } | column -s $'\t' -t
  489. }
  490. fn_details_seriousengine35(){
  491. echo -e "netstat -atunp | grep Sam3_Dedicate"
  492. echo -e ""
  493. {
  494. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  495. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp"
  496. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  497. } | column -s $'\t' -t
  498. }
  499. fn_details_sdtd(){
  500. echo -e "netstat -atunp | grep 7DaysToDie"
  501. echo -e ""
  502. {
  503. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  504. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  505. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  506. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
  507. echo -e "> Telnet\tINBOUND\t${telnetport}\ttcp"
  508. } | column -s $'\t' -t
  509. echo -e ""
  510. echo -e "${lightgreen}${servername} WebAdmin${default}"
  511. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  512. {
  513. echo -e "${blue}WebAdmin enabled:\t${default}${webadminenabled}"
  514. echo -e "${blue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
  515. echo -e "${blue}WebAdmin password:\t${default}${webadminpass}"
  516. } | column -s $'\t' -t
  517. echo -e ""
  518. echo -e "${lightgreen}${servername} Telnet${default}"
  519. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  520. {
  521. echo -e "${blue}Telnet enabled:\t${default}${telnetenabled}"
  522. echo -e "${blue}Telnet address:\t${default}${ip} ${telnetport}"
  523. echo -e "${blue}Telnet password:\t${default}${telnetpass}"
  524. } | column -s $'\t' -t
  525. }
  526. fn_details_source(){
  527. echo -e "netstat -atunp | grep srcds_linux"
  528. echo -e ""
  529. {
  530. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  531. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
  532. echo -e "> SourceTV\tINBOUND\t${sourcetvport}\tudp"
  533. echo -e "< Client\tOUTBOUND\t${clientport}\tudp"
  534. } | column -s $'\t' -t
  535. }
  536. fn_details_spark(){
  537. echo -e "netstat -atunp | grep server_linux3"
  538. echo -e ""
  539. {
  540. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  541. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  542. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  543. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
  544. } | column -s $'\t' -t
  545. echo -e ""
  546. echo -e "${lightgreen}${servername} WebAdmin${default}"
  547. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  548. {
  549. echo -e "${blue}WebAdmin url:\t${default}http://${ip}:${webadminport}/index.html"
  550. echo -e "${blue}WebAdmin username:\t${default}${webadminuser}"
  551. echo -e "${blue}WebAdmin password:\t${default}${webadminpass}"
  552. } | column -s $'\t' -t
  553. }
  554. fn_details_starbound(){
  555. echo -e "netstat -atunp | grep starbound"
  556. echo -e ""
  557. {
  558. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  559. echo -e "> Game\tINBOUND\t${port}\ttcp"
  560. echo -e "> Query\tINBOUND\t${queryport}\ttcp"
  561. echo -e "> Rcon\tINBOUND\t${rconport}\ttcp"
  562. } | column -s $'\t' -t
  563. }
  564. fn_details_teamspeak3(){
  565. echo -e "netstat -atunp | grep ts3server"
  566. echo -e ""
  567. {
  568. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  569. echo -e "> Voice\tINBOUND\t${port}\tudp"
  570. echo -e "> ServerQuery\tINBOUND\t${queryport}\ttcp"
  571. echo -e "> File transfer\tINBOUND\t${fileport}\ttcp"
  572. } | column -s $'\t' -t
  573. }
  574. fn_details_teeworlds(){
  575. echo -e "netstat -atunp | grep teeworlds_srv"
  576. echo -e ""
  577. {
  578. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  579. echo -e "> Game\tINBOUND\t${port}\ttcp"
  580. } | column -s $'\t' -t
  581. }
  582. fn_details_terraria(){
  583. echo -e "netstat -atunp | grep TerrariaServer"
  584. echo -e ""
  585. {
  586. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  587. echo -e "> Game\tINBOUND\t${port}\ttcp"
  588. } | column -s $'\t' -t
  589. }
  590. fn_details_unreal(){
  591. echo -e "netstat -atunp | grep ucc-bin"
  592. echo -e ""
  593. {
  594. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL\tINI VARIABLE"
  595. echo -e "> Game\tINBOUND\t${port}\tudp\tPort=${port}"
  596. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  597. if [ "${engine}" == "unreal" ]; then
  598. echo -e "< UdpLink Port (random)\tOUTBOUND\t${udplinkport}+\tudp"
  599. fi
  600. if [ "${engine}" != "unreal" ] && [ "${appid}" != "223250" ]; then
  601. echo -e "> GameSpy query\tINBOUND\t${gsqueryport}\tudp\tOldQueryPortNumber=${gsqueryport}"
  602. fi
  603. if [ "${appid}" == "215360" ]; then
  604. echo -e "< Master server\tOUTBOUND\t28852\ttcp/udp"
  605. else
  606. echo -e "< Master server\tOUTBOUND\t28900/28902\ttcp/udp"
  607. fi
  608. if [ "${appid}" ]; then
  609. if [ "${appid}" == "223250" ]; then
  610. echo -e "< Steam\tOUTBOUND\t20610\tudp"
  611. else
  612. echo -e "< Steam\tOUTBOUND\t20660\tudp"
  613. fi
  614. fi
  615. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp\tListenPort=${webadminport}"
  616. } | column -s $'\t' -t
  617. echo -e ""
  618. echo -e "${lightgreen}${servername} WebAdmin${default}"
  619. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  620. {
  621. echo -e "${blue}WebAdmin enabled:\t${default}${webadminenabled}"
  622. echo -e "${blue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
  623. echo -e "${blue}WebAdmin username:\t${default}${webadminuser}"
  624. echo -e "${blue}WebAdmin password:\t${default}${webadminpass}"
  625. } | column -s $'\t' -t
  626. }
  627. fn_details_ut3(){
  628. echo -e "netstat -atunp | grep ut3-bin"
  629. echo -e ""
  630. {
  631. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  632. echo -e "> Game/Query\tINBOUND\t${port}\ttcp/udp"
  633. } | column -s $'\t' -t
  634. }
  635. fn_details_wolfensteinenemyterritory(){
  636. echo -e "netstat -atunp | grep etded"
  637. echo -e ""
  638. {
  639. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  640. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  641. } | column -s $'\t' -t
  642. }
  643. # Run checks and gathers details to display.
  644. fn_display_details() {
  645. check.sh
  646. info_config.sh
  647. info_distro.sh
  648. info_glibc.sh
  649. info_parms.sh
  650. fn_details_os
  651. fn_details_performance
  652. fn_details_disk
  653. fn_details_gameserver
  654. fn_details_script
  655. fn_details_backup
  656. # Some game servers do not have parms.
  657. if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${engine}" != "avalanche" ]&&[ "${engine}" != "dontstarve" ]&&[ "${engine}" != "projectzomboid" ]; then
  658. fn_parms
  659. fn_details_commandlineparms
  660. fi
  661. fn_details_ports
  662. # Display details depending on game or engine.
  663. if [ "${engine}" == "avalanche" ]; then
  664. fn_details_avalanche
  665. elif [ "${engine}" == "refractor" ]; then
  666. fn_details_refractor
  667. elif [ "${engine}" == "dontstarve" ]; then
  668. fn_details_dontstarve
  669. elif [ "${engine}" == "goldsource" ]; then
  670. fn_details_goldsource
  671. elif [ "${engine}" == "lwjgl2" ]; then
  672. fn_details_minecraft
  673. elif [ "${engine}" == "projectzomboid" ]; then
  674. fn_details_projectzomboid
  675. elif [ "${engine}" == "realvirtuality" ]; then
  676. fn_details_realvirtuality
  677. elif [ "${engine}" == "seriousengine35" ]; then
  678. fn_details_seriousengine35
  679. elif [ "${engine}" == "source" ]; then
  680. fn_details_source
  681. elif [ "${engine}" == "spark" ]; then
  682. fn_details_spark
  683. elif [ "${engine}" == "starbound" ]; then
  684. fn_details_starbound
  685. elif [ "${engine}" == "teeworlds" ]; then
  686. fn_details_teeworlds
  687. elif [ "${engine}" == "terraria" ]; then
  688. fn_details_terraria
  689. elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
  690. fn_details_unreal
  691. elif [ "${engine}" == "unreal3" ]; then
  692. fn_details_ut3
  693. elif [ "${gamename}" == "7 Days To Die" ]; then
  694. fn_details_sdtd
  695. elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
  696. fn_details_ark
  697. elif [ "${gamename}" == "Call of Duty" ]; then
  698. fn_details_cod
  699. elif [ "${gamename}" == "Call of Duty: United Offensive" ]; then
  700. fn_details_coduo
  701. elif [ "${gamename}" == "Call of Duty 2" ]; then
  702. fn_details_cod2
  703. elif [ "${gamename}" == "Call of Duty 4" ]; then
  704. fn_details_cod4
  705. elif [ "${gamename}" == "Call of Duty: World at War" ]; then
  706. fn_details_codwaw
  707. elif [ "${gamename}" == "Hurtworld" ]; then
  708. fn_details_hurtworld
  709. elif [ "${gamename}" == "QuakeWorld" ]; then
  710. fn_details_quake
  711. elif [ "${gamename}" == "Quake 2" ]; then
  712. fn_details_quake2
  713. elif [ "${gamename}" == "Quake 3: Arena" ]; then
  714. fn_details_quake3
  715. elif [ "${gamename}" == "Quake Live" ]; then
  716. fn_details_quakelive
  717. elif [ "${gamename}" == "TeamSpeak 3" ]; then
  718. fn_details_teamspeak3
  719. elif [ "${gamename}" == "Mumble" ]; then
  720. fn_details_mumble
  721. elif [ "${gamename}" == "Rust" ]; then
  722. fn_details_rust
  723. elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
  724. fn_details_wolfensteinenemyterritory
  725. elif [ "${gamename}" == "Factorio" ]; then
  726. fn_details_factorio
  727. else
  728. fn_print_error_nl "Unable to detect server engine."
  729. fi
  730. fn_details_statusbottom
  731. }
  732. if [ -z "${postdetails}" ] ;
  733. then
  734. fn_display_details
  735. core_exit.sh
  736. fi