command_details.sh 26 KB

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