command_details.sh 26 KB

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