command_details.sh 26 KB

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