command_details.sh 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827
  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" "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" "realvirtuality")
  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"
  306. echo -e "> Game\tINBOUND\t${port}\tudp"
  307. # Don't do arithmetics if ever the port wasn't a numeric value
  308. if [ "${port}" -eq "${port}" ]; then
  309. echo -e "> RAW\tINBOUND\t$((port+1))\tudp"
  310. fi
  311. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  312. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  313. } | column -s $'\t' -t
  314. }
  315. fn_details_avalanche(){
  316. echo -e "netstat -atunp | grep Jcmp-Server"
  317. echo -e ""
  318. {
  319. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  320. echo -e "> Game\tINBOUND\t${port}\tudp"
  321. } | column -s $'\t' -t
  322. }
  323. fn_details_cod(){
  324. echo -e "netstat -atunp | grep cod_lnxded"
  325. echo -e ""
  326. {
  327. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  328. echo -e "> Game\tINBOUND\t${port}\tudp"
  329. } | column -s $'\t' -t
  330. }
  331. fn_details_coduo(){
  332. echo -e "netstat -atunp | grep coduo_lnxded"
  333. echo -e ""
  334. {
  335. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  336. echo -e "> Game\tINBOUND\t${port}\tudp"
  337. } | column -s $'\t' -t
  338. }
  339. fn_details_cod2(){
  340. echo -e "netstat -atunp | grep cod2_lnxded"
  341. echo -e ""
  342. {
  343. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  344. echo -e "> Game\tINBOUND\t${port}\tudp"
  345. } | column -s $'\t' -t
  346. }
  347. fn_details_cod4(){
  348. echo -e "netstat -atunp"
  349. echo -e ""
  350. {
  351. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  352. echo -e "> Game\tINBOUND\t${port}\tudp"
  353. } | column -s $'\t' -t
  354. }
  355. fn_details_codwaw(){
  356. echo -e "netstat -atunp | grep codwaw_lnxded"
  357. echo -e ""
  358. {
  359. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  360. echo -e "> Game\tINBOUND\t${port}\tudp"
  361. } | column -s $'\t' -t
  362. }
  363. fn_details_dontstarve(){
  364. echo -e "netstat -atunp | grep dontstarve"
  365. echo -e ""
  366. {
  367. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  368. echo -e "> Game: Server\tINBOUND\t${port}\tudp"
  369. echo -e "> Game: Master\tINBOUND\t${masterport}\tudp"
  370. echo -e "> Steam: Auth\tINBOUND\t${steamauthenticationport}\tudp"
  371. echo -e "> Steam: Master\tINBOUND\t${steammasterserverport}\tudp"
  372. } | column -s $'\t' -t
  373. }
  374. fn_details_factorio(){
  375. echo -e "netstat -atunp | grep factorio"
  376. echo -e ""
  377. {
  378. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  379. echo -e "> Game\tINBOUND\t${port}\ttcp"
  380. } | column -s $'\t' -t
  381. }
  382. fn_details_goldsource(){
  383. echo -e "netstat -atunp | grep hlds_linux"
  384. echo -e ""
  385. {
  386. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  387. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
  388. echo -e "< Client\tOUTBOUND\t${clientport}\tudp"
  389. } | column -s $'\t' -t
  390. }
  391. fn_details_hurtworld(){
  392. echo -e "netstat -atunp | grep Hurtworld"
  393. echo -e ""
  394. {
  395. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  396. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  397. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  398. } | column -s $'\t' -t
  399. }
  400. fn_details_minecraft(){
  401. echo -e "netstat -atunp | grep java"
  402. echo -e ""
  403. {
  404. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  405. echo -e "> Game\tINBOUND\t${port}\tudp"
  406. } | column -s $'\t' -t
  407. }
  408. fn_details_mumble(){
  409. echo -e "netstat -atunp | grep murmur"
  410. echo -e ""
  411. {
  412. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  413. echo -e "> Voice\tINBOUND\t${port}\tudp"
  414. echo -e "> ServerQuery\tINBOUND\t${port}\ttcp"
  415. } | column -s $'\t' -t
  416. }
  417. fn_details_projectzomboid(){
  418. echo -e "netstat -atunp | grep java"
  419. echo -e ""
  420. {
  421. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  422. echo -e "> Game\tINBOUND\t${port}\tudp"
  423. } | column -s $'\t' -t
  424. }
  425. fn_details_quake(){
  426. echo -e "netstat -atunp | grep mvdsv"
  427. echo -e ""
  428. {
  429. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  430. echo -e "> Game\tINBOUND\t${port}\tudp"
  431. } | column -s $'\t' -t
  432. }
  433. fn_details_quake2(){
  434. echo -e "netstat -atunp | grep quake2"
  435. echo -e ""
  436. {
  437. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  438. echo -e "> Game\tINBOUND\t${port}\tudp"
  439. } | column -s $'\t' -t
  440. }
  441. fn_details_quake3(){
  442. echo -e "netstat -atunp | grep q3ded"
  443. echo -e ""
  444. {
  445. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  446. echo -e "> Game\tINBOUND\t${port}\tudp"
  447. } | column -s $'\t' -t
  448. }
  449. fn_details_quakelive(){
  450. echo -e "netstat -atunp | grep qzeroded"
  451. echo -e ""
  452. if [ -z "${port}" ]||[ -z "${rconport}" ]||[ -z "${statsport}" ]; then
  453. echo -e "${red}ERROR!${default} Missing/commented ports in ${servercfg}."
  454. echo -e ""
  455. fi
  456. {
  457. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  458. echo -e "> Game\tINBOUND\t${port}\tudp"
  459. echo -e "> Rcon\tINBOUND\t${rconport}\tudp"
  460. echo -e "> Stats\tINBOUND\t${statsport}\tudp"
  461. } | column -s $'\t' -t
  462. }
  463. fn_details_realvirtuality(){
  464. echo -e "netstat -atunp | grep arma3server"
  465. echo -e ""
  466. # Default port
  467. if [ -z "${port}" ]; then
  468. port="2302"
  469. fi
  470. {
  471. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  472. echo -e "> Game\tINBOUND\t${port}\tudp"
  473. # Don't do arithmetics if ever the port wasn't a numeric value
  474. if [ "${port}" -eq "${port}" ]; then
  475. echo -e "> Steam: Query\tINBOUND\t$((port+1))\tudp"
  476. echo -e "> Steam: Master traffic\tINBOUND\t$((port+2))\tudp"
  477. echo -e "> Undocumented Port\tINBOUND\t$((port+3))\tudp"
  478. fi
  479. } | column -s $'\t' -t
  480. }
  481. fn_details_refractor(){
  482. echo -e "netstat -atunp | grep bf1942_lnxd"
  483. echo -e ""
  484. {
  485. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  486. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  487. echo -e "> Steam: Query\tINBOUND\t${queryport}\tudp"
  488. } | column -s $'\t' -t
  489. }
  490. fn_details_rust(){
  491. echo -e "netstat -atunp | grep Rust"
  492. echo -e ""
  493. {
  494. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  495. echo -e "> Game/Query\tINBOUND\t${port}\ttcp/udp"
  496. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  497. } | column -s $'\t' -t
  498. }
  499. fn_details_seriousengine35(){
  500. echo -e "netstat -atunp | grep Sam3_Dedicate"
  501. echo -e ""
  502. {
  503. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  504. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp"
  505. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  506. } | column -s $'\t' -t
  507. }
  508. fn_details_sdtd(){
  509. echo -e "netstat -atunp | grep 7DaysToDie"
  510. echo -e ""
  511. {
  512. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  513. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  514. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  515. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
  516. echo -e "> Telnet\tINBOUND\t${telnetport}\ttcp"
  517. } | column -s $'\t' -t
  518. echo -e ""
  519. echo -e "${lightgreen}${servername} WebAdmin${default}"
  520. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  521. {
  522. echo -e "${blue}WebAdmin enabled:\t${default}${webadminenabled}"
  523. echo -e "${blue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
  524. echo -e "${blue}WebAdmin password:\t${default}${webadminpass}"
  525. } | column -s $'\t' -t
  526. echo -e ""
  527. echo -e "${lightgreen}${servername} Telnet${default}"
  528. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  529. {
  530. echo -e "${blue}Telnet enabled:\t${default}${telnetenabled}"
  531. echo -e "${blue}Telnet address:\t${default}${ip} ${telnetport}"
  532. echo -e "${blue}Telnet password:\t${default}${telnetpass}"
  533. } | column -s $'\t' -t
  534. }
  535. fn_details_source(){
  536. echo -e "netstat -atunp | grep srcds_linux"
  537. echo -e ""
  538. {
  539. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  540. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
  541. echo -e "> SourceTV\tINBOUND\t${sourcetvport}\tudp"
  542. echo -e "< Client\tOUTBOUND\t${clientport}\tudp"
  543. } | column -s $'\t' -t
  544. }
  545. fn_details_spark(){
  546. echo -e "netstat -atunp | grep server_linux3"
  547. echo -e ""
  548. {
  549. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  550. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  551. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  552. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
  553. } | column -s $'\t' -t
  554. echo -e ""
  555. echo -e "${lightgreen}${servername} WebAdmin${default}"
  556. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  557. {
  558. echo -e "${blue}WebAdmin url:\t${default}http://${ip}:${webadminport}/index.html"
  559. echo -e "${blue}WebAdmin username:\t${default}${webadminuser}"
  560. echo -e "${blue}WebAdmin password:\t${default}${webadminpass}"
  561. } | column -s $'\t' -t
  562. }
  563. fn_details_starbound(){
  564. echo -e "netstat -atunp | grep starbound"
  565. echo -e ""
  566. {
  567. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  568. echo -e "> Game\tINBOUND\t${port}\ttcp"
  569. echo -e "> Query\tINBOUND\t${queryport}\ttcp"
  570. echo -e "> Rcon\tINBOUND\t${rconport}\ttcp"
  571. } | column -s $'\t' -t
  572. }
  573. fn_details_teamspeak3(){
  574. echo -e "netstat -atunp | grep ts3server"
  575. echo -e ""
  576. {
  577. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  578. echo -e "> Voice\tINBOUND\t${port}\tudp"
  579. echo -e "> ServerQuery\tINBOUND\t${queryport}\ttcp"
  580. echo -e "> File transfer\tINBOUND\t${fileport}\ttcp"
  581. } | column -s $'\t' -t
  582. }
  583. fn_details_teeworlds(){
  584. echo -e "netstat -atunp | grep teeworlds_srv"
  585. echo -e ""
  586. {
  587. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  588. echo -e "> Game\tINBOUND\t${port}\ttcp"
  589. } | column -s $'\t' -t
  590. }
  591. fn_details_terraria(){
  592. echo -e "netstat -atunp | grep TerrariaServer"
  593. echo -e ""
  594. {
  595. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  596. echo -e "> Game\tINBOUND\t${port}\ttcp"
  597. } | column -s $'\t' -t
  598. }
  599. fn_details_unreal(){
  600. echo -e "netstat -atunp | grep ucc-bin"
  601. echo -e ""
  602. {
  603. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL\tINI VARIABLE"
  604. echo -e "> Game\tINBOUND\t${port}\tudp\tPort=${port}"
  605. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  606. if [ "${engine}" == "unreal" ]; then
  607. echo -e "< UdpLink Port (random)\tOUTBOUND\t${udplinkport}+\tudp"
  608. fi
  609. if [ "${engine}" != "unreal" ] && [ "${appid}" != "223250" ]; then
  610. echo -e "> GameSpy query\tINBOUND\t${gsqueryport}\tudp\tOldQueryPortNumber=${gsqueryport}"
  611. fi
  612. if [ "${appid}" == "215360" ]; then
  613. echo -e "< Master server\tOUTBOUND\t28852\ttcp/udp"
  614. else
  615. echo -e "< Master server\tOUTBOUND\t28900/28902\ttcp/udp"
  616. fi
  617. if [ "${appid}" ]; then
  618. if [ "${appid}" == "223250" ]; then
  619. echo -e "< Steam\tOUTBOUND\t20610\tudp"
  620. else
  621. echo -e "< Steam\tOUTBOUND\t20660\tudp"
  622. fi
  623. fi
  624. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp\tListenPort=${webadminport}"
  625. } | column -s $'\t' -t
  626. echo -e ""
  627. echo -e "${lightgreen}${servername} WebAdmin${default}"
  628. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  629. {
  630. echo -e "${blue}WebAdmin enabled:\t${default}${webadminenabled}"
  631. echo -e "${blue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
  632. echo -e "${blue}WebAdmin username:\t${default}${webadminuser}"
  633. echo -e "${blue}WebAdmin password:\t${default}${webadminpass}"
  634. } | column -s $'\t' -t
  635. }
  636. fn_details_ut3(){
  637. echo -e "netstat -atunp | grep ut3-bin"
  638. echo -e ""
  639. {
  640. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  641. echo -e "> Game/Query\tINBOUND\t${port}\ttcp/udp"
  642. } | column -s $'\t' -t
  643. }
  644. fn_details_wolfensteinenemyterritory(){
  645. echo -e "netstat -atunp | grep etded"
  646. echo -e ""
  647. {
  648. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  649. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  650. } | column -s $'\t' -t
  651. }
  652. # Run checks and gathers details to display.
  653. fn_display_details() {
  654. check.sh
  655. info_config.sh
  656. info_distro.sh
  657. info_glibc.sh
  658. info_parms.sh
  659. fn_details_os
  660. fn_details_performance
  661. fn_details_disk
  662. fn_details_gameserver
  663. fn_details_script
  664. fn_details_backup
  665. # Some game servers do not have parms.
  666. if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${engine}" != "avalanche" ]&&[ "${engine}" != "dontstarve" ]&&[ "${engine}" != "projectzomboid" ]; then
  667. fn_parms
  668. fn_details_commandlineparms
  669. fi
  670. fn_details_ports
  671. # Display details depending on game or engine.
  672. if [ "${engine}" == "avalanche" ]; then
  673. fn_details_avalanche
  674. elif [ "${engine}" == "refractor" ]; then
  675. fn_details_refractor
  676. elif [ "${engine}" == "dontstarve" ]; then
  677. fn_details_dontstarve
  678. elif [ "${engine}" == "goldsource" ]; then
  679. fn_details_goldsource
  680. elif [ "${engine}" == "lwjgl2" ]; then
  681. fn_details_minecraft
  682. elif [ "${engine}" == "projectzomboid" ]; then
  683. fn_details_projectzomboid
  684. elif [ "${engine}" == "realvirtuality" ]; then
  685. fn_details_realvirtuality
  686. elif [ "${engine}" == "seriousengine35" ]; then
  687. fn_details_seriousengine35
  688. elif [ "${engine}" == "source" ]; then
  689. fn_details_source
  690. elif [ "${engine}" == "spark" ]; then
  691. fn_details_spark
  692. elif [ "${engine}" == "starbound" ]; then
  693. fn_details_starbound
  694. elif [ "${engine}" == "teeworlds" ]; then
  695. fn_details_teeworlds
  696. elif [ "${engine}" == "terraria" ]; then
  697. fn_details_terraria
  698. elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
  699. fn_details_unreal
  700. elif [ "${engine}" == "unreal3" ]; then
  701. fn_details_ut3
  702. elif [ "${gamename}" == "7 Days To Die" ]; then
  703. fn_details_sdtd
  704. elif [ "${gamename}" == "ARK: Survival Evolved" ]; then
  705. fn_details_ark
  706. elif [ "${gamename}" == "Call of Duty" ]; then
  707. fn_details_cod
  708. elif [ "${gamename}" == "Call of Duty: United Offensive" ]; then
  709. fn_details_coduo
  710. elif [ "${gamename}" == "Call of Duty 2" ]; then
  711. fn_details_cod2
  712. elif [ "${gamename}" == "Call of Duty 4" ]; then
  713. fn_details_cod4
  714. elif [ "${gamename}" == "Call of Duty: World at War" ]; then
  715. fn_details_codwaw
  716. elif [ "${gamename}" == "Hurtworld" ]; then
  717. fn_details_hurtworld
  718. elif [ "${gamename}" == "QuakeWorld" ]; then
  719. fn_details_quake
  720. elif [ "${gamename}" == "Quake 2" ]; then
  721. fn_details_quake2
  722. elif [ "${gamename}" == "Quake 3: Arena" ]; then
  723. fn_details_quake3
  724. elif [ "${gamename}" == "Quake Live" ]; then
  725. fn_details_quakelive
  726. elif [ "${gamename}" == "TeamSpeak 3" ]; then
  727. fn_details_teamspeak3
  728. elif [ "${gamename}" == "Mumble" ]; then
  729. fn_details_mumble
  730. elif [ "${gamename}" == "Rust" ]; then
  731. fn_details_rust
  732. elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
  733. fn_details_wolfensteinenemyterritory
  734. elif [ "${gamename}" == "Factorio" ]; then
  735. fn_details_factorio
  736. else
  737. fn_print_error_nl "Unable to detect server engine."
  738. fi
  739. fn_details_statusbottom
  740. }
  741. if [ -z "${postdetails}" ] ;
  742. then
  743. fn_display_details
  744. core_exit.sh
  745. fi