command_details.sh 25 KB

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