command_details.sh 26 KB

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