command_details.sh 24 KB

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