command_details.sh 26 KB

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