info_messages.sh 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938
  1. #!/bin/bash
  2. # LinuxGSM info_messages.sh function
  3. # Author: Daniel Gibbs
  4. # Website: https://gameservermanagers.com
  5. # Description: Defines server info messages for details, alerts.
  6. # Standard Details
  7. # This applies to all engines
  8. fn_info_message_head(){
  9. echo -e ""
  10. echo -e "${lightyellow}Summary${default}"
  11. fn_messages_separator
  12. echo -e "Message"
  13. echo -e "${alertbody}"
  14. echo -e ""
  15. echo -e "Game"
  16. echo -e "${gamename}"
  17. echo -e ""
  18. echo -e "Server name"
  19. echo -e "${servername}"
  20. echo -e ""
  21. echo -e "Hostname"
  22. echo -e "${HOSTNAME}"
  23. echo -e ""
  24. echo -e "Server IP"
  25. echo -e "${ip}:${port}"
  26. echo -e ""
  27. echo -e "More info"
  28. echo -e "${alerturl}"
  29. }
  30. fn_info_message_distro(){
  31. #
  32. # Distro Details
  33. # =====================================
  34. # Distro: Ubuntu 14.04.4 LTS
  35. # Arch: x86_64
  36. # Kernel: 3.13.0-79-generic
  37. # Hostname: hostname
  38. # tmux: tmux 1.8
  39. # GLIBC: 2.19
  40. echo -e ""
  41. echo -e "${lightyellow}Distro Details${default}"
  42. fn_messages_separator
  43. {
  44. echo -e "${blue}Distro:\t${default}${distroname}"
  45. echo -e "${blue}Arch:\t${default}${arch}"
  46. echo -e "${blue}Kernel:\t${default}${kernel}"
  47. echo -e "${blue}Hostname:\t${default}${HOSTNAME}"
  48. echo -e "${blue}tmux:\t${default}${tmuxv}"
  49. echo -e "${blue}GLIBC:\t${default}${glibcversion}"
  50. } | column -s $'\t' -t
  51. }
  52. fn_info_message_performance(){
  53. #
  54. # Performance
  55. # =====================================
  56. # Uptime: 55d, 3h, 38m
  57. # Avg Load: 1.00, 1.01, 0.78
  58. #
  59. # Mem: total used free cached
  60. # Physical: 741M 656M 85M 256M
  61. # Swap: 0B 0B 0B
  62. echo -e ""
  63. echo -e "${lightyellow}Performance${default}"
  64. {
  65. echo -e "${blue}Uptime:\t${default}${days}d, ${hours}h, ${minutes}m"
  66. echo -e "${blue}Avg Load:\t${default}${load}"
  67. } | column -s $'\t' -t
  68. echo -e ""
  69. {
  70. echo -e "${blue}Mem:\t${blue}total\t used\t free\t cached${default}"
  71. echo -e "${blue}Physical:\t${default}${physmemtotal}\t${physmemused}\t${physmemfree}\t${physmemcached}${default}"
  72. echo -e "${blue}Swap:\t${default}${swaptotal}\t${swapused}\t${swapfree}${default}"
  73. } | column -s $'\t' -t
  74. }
  75. fn_info_message_disk(){
  76. #
  77. # Storage
  78. # =====================================
  79. # Filesystem: /dev/disk/by-uuid/320c8edd-a2ce-4a23-8c9d-e00a7af2d6ff
  80. # Total: 15G
  81. # Used: 8.4G
  82. # Available: 5.7G
  83. # LinuxGSM Total: 1G
  84. # Serverfiles: 961M
  85. # Backups: 2G
  86. echo -e ""
  87. echo -e "${lightyellow}Storage${default}"
  88. fn_messages_separator
  89. {
  90. echo -e "${blue}Filesystem:\t${default}${filesystem}"
  91. echo -e "${blue}Total:\t${default}${totalspace}"
  92. echo -e "${blue}Used:\t${default}${usedspace}"
  93. echo -e "${blue}Available:\t${default}${availspace}"
  94. echo -e "${blue}LinuxGSM Total:\t${default}${rootdirdu}"
  95. echo -e "${blue}Serverfiles:\t${default}${serverfilesdu}"
  96. if [ -d "${backupdir}" ]; then
  97. echo -e "${blue}Backups:\t${default}${backupdirdu}"
  98. fi
  99. } | column -s $'\t' -t
  100. }
  101. fn_info_message_gameserver(){
  102. #
  103. # Quake Live Server Details
  104. # =====================================
  105. # Server name: ql-server
  106. # Server IP: 1.2.3.4:27960
  107. # RCON password: CHANGE_ME
  108. # Server password: NOT SET
  109. # Maxplayers: 16
  110. # Status: OFFLINE
  111. echo -e ""
  112. echo -e "${lightgreen}${gamename} Server Details${default}"
  113. fn_messages_separator
  114. {
  115. # Server name
  116. if [ -n "${servername}" ]; then
  117. echo -e "${blue}Server name:\t${default}${servername}"
  118. fi
  119. # Branch
  120. if [ -n "${branch}" ]; then
  121. echo -e "${blue}Branch:\t${default}${branch}"
  122. fi
  123. # Server ip
  124. echo -e "${blue}Server IP:\t${default}${ip}:${port}"
  125. # Server password
  126. if [ -n "${serverpassword}" ]; then
  127. echo -e "${blue}Server password:\t${default}${serverpassword}"
  128. fi
  129. # RCON password
  130. if [ -n "${rconpassword}" ]; then
  131. echo -e "${blue}RCON password:\t${default}${rconpassword}"
  132. fi
  133. # RCON web (Rust)
  134. if [ -n "${rconweb}" ]; then
  135. echo -e "${blue}RCON web:\t${default}${rconweb}"
  136. fi
  137. # Admin password
  138. if [ -n "${adminpassword}" ]; then
  139. echo -e "${blue}Admin password:\t${default}${adminpassword}"
  140. fi
  141. # Stats password (Quake Live)
  142. if [ -n "${statspassword}" ]; then
  143. echo -e "${blue}Stats password:\t${default}${statspassword}"
  144. fi
  145. # Maxplayers
  146. if [ -n "${maxplayers}" ]; then
  147. echo -e "${blue}Maxplayers:\t${default}${maxplayers}"
  148. fi
  149. # Game mode
  150. if [ -n "${gamemode}" ]; then
  151. echo -e "${blue}Game mode:\t${default}${gamemode}"
  152. fi
  153. # Game world
  154. if [ -n "${gameworld}" ]; then
  155. echo -e "${blue}Game world:\t${default}${gameworld}"
  156. fi
  157. # Tick rate
  158. if [ -n "${tickrate}" ]; then
  159. echo -e "${blue}Tick rate:\t${default}${tickrate}"
  160. fi
  161. # Sharding (Don't Starve Together)
  162. if [ -n "${sharding}" ]; then
  163. echo -e "${blue}Sharding:\t${default}${sharding}"
  164. fi
  165. # Master (Don't Starve Together)
  166. if [ -n "${master}" ]; then
  167. echo -e "${blue}Master:\t${default}${master}"
  168. fi
  169. # Shard (Don't Starve Together)
  170. if [ -n "${shard}" ]; then
  171. echo -e "${blue}Shard:\t${default}${shard}"
  172. fi
  173. # Cluster (Don't Starve Together)
  174. if [ -n "${cluster}" ]; then
  175. echo -e "${blue}Cluster:\t${default}${cluster}"
  176. fi
  177. # Cave (Don't Starve Together)
  178. if [ -n "${cave}" ]; then
  179. echo -e "${blue}Cave:\t${default}${cave}"
  180. fi
  181. # Creativemode (Hurtworld)
  182. if [ -n "${creativemode}" ]; then
  183. echo -e "${blue}Creativemode:\t${default}${creativemode}"
  184. fi
  185. # TeamSpeak dbplugin
  186. if [ -n "${dbplugin}" ]; then
  187. echo -e "${blue}dbplugin:\t${default}${dbplugin}"
  188. fi
  189. # ASE (Multi Theft Auto)
  190. if [ -n "${ase}" ]; then
  191. echo -e "${blue}ASE:\t${default}${ase}"
  192. fi
  193. # Save interval (Rust)
  194. if [ -n "${saveinterval}" ]; then
  195. echo -e "${blue}ASE:\t${default}${saveinterval} s"
  196. fi
  197. # Random map rotation mode (Squad)
  198. if [ -n "${randommap}" ]; then
  199. echo -e "${blue}Map rotation:\t${default}${randommap}"
  200. fi
  201. # Online status
  202. if [ "${status}" == "0" ]; then
  203. echo -e "${blue}Status:\t${red}OFFLINE${default}"
  204. else
  205. echo -e "${blue}Status:\t${green}ONLINE${default}"
  206. fi
  207. } | column -s $'\t' -t
  208. echo -e ""
  209. }
  210. fn_info_message_script(){
  211. #
  212. # qlserver Script Details
  213. # =====================================
  214. # Service name: ql-server
  215. # qlserver version: 150316
  216. # User: lgsm
  217. # Email alert: off
  218. # Update on start: off
  219. # Location: /home/lgsm/qlserver
  220. # Config file: /home/lgsm/qlserver/serverfiles/baseq3/ql-server.cfg
  221. echo -e "${lightgreen}${selfname} Script Details${default}"
  222. fn_messages_separator
  223. {
  224. # Service name
  225. echo -e "${blue}Service name:\t${default}${servicename}"
  226. # Script version
  227. if [ -n "${version}" ]; then
  228. echo -e "${blue}${selfname} version:\t${default}${version}"
  229. fi
  230. # User
  231. echo -e "${blue}User:\t${default}$(whoami)"
  232. # GLIBC required
  233. if [ -n "${glibcrequired}" ]; then
  234. if [ "${glibcrequired}" == "NOT REQUIRED" ]; then
  235. :
  236. elif [ "${glibcrequired}" == "UNKNOWN" ]; then
  237. echo -e "${blue}GLIBC required:\t${red}${glibcrequired}"
  238. elif [ "$(printf '%s\n'${glibcrequired}'\n' ${glibcversion} | sort -V | head -n 1)" != "${glibcrequired}" ]; then
  239. if [ "${glibcfix}" == "yes" ]; then
  240. echo -e "${blue}GLIBC required:\t${red}${glibcrequired} ${default}(${green}Using GLIBC fix${default})"
  241. else
  242. echo -e "${blue}GLIBC required:\t${red}${glibcrequired} ${default}(${red}GLIBC version too old${default})"
  243. fi
  244. else
  245. echo -e "${blue}GLIBC required:\t${green}${glibcrequired}${default}"
  246. fi
  247. fi
  248. # Email alert
  249. echo -e "${blue}Email alert:\t${default}${emailalert}"
  250. # Pushbullet alert
  251. echo -e "${blue}Pushbullet alert:\t${default}${pushbulletalert}"
  252. # Update on start
  253. if [ -n "${updateonstart}" ]; then
  254. echo -e "${blue}Update on start:\t${default}${updateonstart}"
  255. fi
  256. # Script location
  257. echo -e "${blue}Location:\t${default}${rootdir}"
  258. # Config file location
  259. if [ -n "${servercfgfullpath}" ]; then
  260. if [ -f "${servercfgfullpath}" ]; then
  261. echo -e "${blue}Config file:\t${default}${servercfgfullpath}"
  262. elif [ -d "${servercfgfullpath}" ]; then
  263. echo -e "${blue}Config dir:\t${default}${servercfgfullpath}"
  264. else
  265. echo -e "${blue}Config file:\t${default}${red}${servercfgfullpath}${default} (${red}FILE MISSING${default})"
  266. fi
  267. fi
  268. # Network config file location (ARMA 3)
  269. if [ -n "${networkcfgfullpath}" ]; then
  270. echo -e "${blue}Network config file:\t${default}${networkcfgfullpath}"
  271. fi
  272. } | column -s $'\t' -t
  273. }
  274. fn_info_message_backup(){
  275. #
  276. # Backups
  277. # =====================================
  278. # No. of backups: 1
  279. # Latest backup:
  280. # date: Fri May 6 18:34:19 UTC 2016
  281. # file: /home/lgsm/qlserver/backups/ql-server-2016-05-06-183239.tar.gz
  282. # size: 945M
  283. echo -e ""
  284. echo -e "${lightgreen}Backups${default}"
  285. fn_messages_separator
  286. if [ ! -d "${backupdir}" ]||[ "${backupcount}" == "0" ]; then
  287. echo -e "No Backups created"
  288. else
  289. {
  290. echo -e "${blue}No. of backups:\t${default}${backupcount}"
  291. echo -e "${blue}Latest backup:${default}"
  292. if [ "${lastbackupdaysago}" == "0" ]; then
  293. echo -e "${blue} date:\t${default}${lastbackupdate} (less than 1 day ago)"
  294. elif [ "${lastbackupdaysago}" == "1" ]; then
  295. echo -e "${blue} date:\t${default}${lastbackupdate} (1 day ago)"
  296. else
  297. echo -e "${blue} date:\t${default}${lastbackupdate} (${lastbackupdaysago} days ago)"
  298. fi
  299. echo -e "${blue} file:\t${default}${lastbackup}"
  300. echo -e "${blue} size:\t${default}${lastbackupsize}"
  301. } | column -s $'\t' -t
  302. fi
  303. }
  304. fn_info_message_commandlineparms(){
  305. #
  306. # Command-line Parameters
  307. # =====================================
  308. # ./run_server_x86.sh +set net_strict 1
  309. echo -e ""
  310. echo -e "${lightgreen}Command-line Parameters${default}"
  311. fn_messages_separator
  312. echo -e "${executable} ${parms}"
  313. }
  314. fn_info_message_ports(){
  315. # Ports
  316. # =====================================
  317. # Change ports by editing the parameters in:
  318. # /home/lgsm/qlserver/serverfiles/baseq3/ql-server.cfg
  319. echo -e ""
  320. echo -e "${lightgreen}Ports${default}"
  321. fn_messages_separator
  322. echo -e "Change ports by editing the parameters in:"
  323. parmslocation="${red}UNKNOWN${default}"
  324. # engines/games that require editing in the config file
  325. 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" )
  326. for port_edit in "${ports_edit_array[@]}"
  327. do
  328. if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]; then
  329. parmslocation="${servercfgfullpath}"
  330. fi
  331. done
  332. # engines/games that require editing in the script file
  333. local ports_edit_array=( "goldsource" "Factorio" "Hurtworld" "iw3.0" "Rust" "spark" "source" "starbound" "unreal4" "realvirtuality")
  334. for port_edit in "${ports_edit_array[@]}"
  335. do
  336. if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]; then
  337. parmslocation="${selfname}"
  338. fi
  339. done
  340. echo -e "${parmslocation}"
  341. echo -e ""
  342. echo -e "Useful port diagnostic command:"
  343. }
  344. fn_info_message_statusbottom(){
  345. echo -e ""
  346. if [ "${status}" == "0" ]; then
  347. echo -e "${blue}Status:\t${red}OFFLINE${default}"
  348. else
  349. echo -e "${blue}Status:\t${green}ONLINE${default}"
  350. fi
  351. echo -e ""
  352. }
  353. # Engine/Game Specific details
  354. fn_info_message_ark(){
  355. echo -e "netstat -atunp | grep ShooterGame"
  356. echo -e ""
  357. {
  358. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  359. echo -e "> Game\tINBOUND\t${port}\tudp"
  360. # Don't do arithmetics if ever the port wasn't a numeric value
  361. if [ "${port}" -eq "${port}" ]; then
  362. echo -e "> RAW\tINBOUND\t$((port+1))\tudp"
  363. fi
  364. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  365. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  366. } | column -s $'\t' -t
  367. }
  368. fn_info_message_ballisticoverkill(){
  369. echo -e "netstat -atunp | grep BODS.x86"
  370. echo -e ""
  371. {
  372. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  373. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  374. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  375. } | column -s $'\t' -t
  376. }
  377. fn_info_message_avalanche(){
  378. echo -e "netstat -atunp | grep Jcmp-Server"
  379. echo -e ""
  380. {
  381. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  382. echo -e "> Game\tINBOUND\t${port}\tudp"
  383. } | column -s $'\t' -t
  384. }
  385. fn_info_message_cod(){
  386. echo -e "netstat -atunp | grep cod_lnxded"
  387. echo -e ""
  388. {
  389. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  390. echo -e "> Game\tINBOUND\t${port}\tudp"
  391. } | column -s $'\t' -t
  392. }
  393. fn_info_message_coduo(){
  394. echo -e "netstat -atunp | grep coduo_lnxded"
  395. echo -e ""
  396. {
  397. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  398. echo -e "> Game\tINBOUND\t${port}\tudp"
  399. } | column -s $'\t' -t
  400. }
  401. fn_info_message_cod2(){
  402. echo -e "netstat -atunp | grep cod2_lnxded"
  403. echo -e ""
  404. {
  405. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  406. echo -e "> Game\tINBOUND\t${port}\tudp"
  407. } | column -s $'\t' -t
  408. }
  409. fn_info_message_cod4(){
  410. echo -e "netstat -atunp"
  411. echo -e ""
  412. {
  413. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  414. echo -e "> Game\tINBOUND\t${port}\tudp"
  415. } | column -s $'\t' -t
  416. }
  417. fn_info_message_codwaw(){
  418. echo -e "netstat -atunp | grep codwaw_lnxded"
  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_info_message_dontstarve(){
  426. echo -e "netstat -atunp | grep dontstarve"
  427. echo -e ""
  428. {
  429. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  430. echo -e "> Game: Server\tINBOUND\t${port}\tudp"
  431. echo -e "> Game: Master\tINBOUND\t${masterport}\tudp"
  432. echo -e "> Steam: Auth\tINBOUND\t${steamauthenticationport}\tudp"
  433. echo -e "> Steam: Master\tINBOUND\t${steammasterserverport}\tudp"
  434. } | column -s $'\t' -t
  435. }
  436. fn_info_message_factorio(){
  437. echo -e "netstat -atunp | grep factorio"
  438. echo -e ""
  439. {
  440. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  441. echo -e "> Game\tINBOUND\t${port}\ttcp"
  442. } | column -s $'\t' -t
  443. }
  444. fn_info_message_goldsource(){
  445. echo -e "netstat -atunp | grep hlds_linux"
  446. echo -e ""
  447. {
  448. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  449. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
  450. echo -e "< Client\tOUTBOUND\t${clientport}\tudp"
  451. } | column -s $'\t' -t
  452. }
  453. fn_info_message_hurtworld(){
  454. echo -e "netstat -atunp | grep Hurtworld"
  455. echo -e ""
  456. {
  457. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  458. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  459. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  460. } | column -s $'\t' -t
  461. }
  462. fn_info_message_minecraft(){
  463. echo -e "netstat -atunp | grep java"
  464. echo -e ""
  465. {
  466. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  467. echo -e "> Game\tINBOUND\t${port}\tudp"
  468. } | column -s $'\t' -t
  469. }
  470. fn_info_message_mumble(){
  471. echo -e "netstat -atunp | grep murmur"
  472. echo -e ""
  473. {
  474. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  475. echo -e "> Voice\tINBOUND\t${port}\tudp"
  476. echo -e "> ServerQuery\tINBOUND\t${port}\ttcp"
  477. } | column -s $'\t' -t
  478. }
  479. fn_info_message_projectcars(){
  480. echo -e "netstat -atunp | grep DedicatedS"
  481. echo -e ""
  482. {
  483. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  484. echo -e "> Game\tINBOUND\t${port}\tudp"
  485. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  486. echo -e "> Steam\tINBOUND\t${steamport}\tudp"
  487. } | column -s $'\t' -t
  488. }
  489. fn_info_message_projectzomboid(){
  490. echo -e "netstat -atunp | grep java"
  491. echo -e ""
  492. {
  493. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  494. echo -e "> Game\tINBOUND\t${port}\tudp"
  495. } | column -s $'\t' -t
  496. }
  497. fn_info_message_quake(){
  498. echo -e "netstat -atunp | grep mvdsv"
  499. echo -e ""
  500. {
  501. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  502. echo -e "> Game\tINBOUND\t${port}\tudp"
  503. } | column -s $'\t' -t
  504. }
  505. fn_info_message_quake2(){
  506. echo -e "netstat -atunp | grep quake2"
  507. echo -e ""
  508. {
  509. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  510. echo -e "> Game\tINBOUND\t${port}\tudp"
  511. } | column -s $'\t' -t
  512. }
  513. fn_info_message_quake3(){
  514. echo -e "netstat -atunp | grep q3ded"
  515. echo -e ""
  516. {
  517. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  518. echo -e "> Game\tINBOUND\t${port}\tudp"
  519. } | column -s $'\t' -t
  520. }
  521. fn_info_message_quakelive(){
  522. echo -e "netstat -atunp | grep qzeroded"
  523. echo -e ""
  524. if [ -z "${port}" ]||[ -z "${rconport}" ]||[ -z "${statsport}" ]; then
  525. echo -e "${red}ERROR!${default} Missing/commented ports in ${servercfg}."
  526. echo -e ""
  527. fi
  528. {
  529. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  530. echo -e "> Game\tINBOUND\t${port}\tudp"
  531. echo -e "> Rcon\tINBOUND\t${rconport}\tudp"
  532. echo -e "> Stats\tINBOUND\t${statsport}\tudp"
  533. } | column -s $'\t' -t
  534. }
  535. fn_info_message_realvirtuality(){
  536. echo -e "netstat -atunp | grep arma3server"
  537. echo -e ""
  538. # Default port
  539. if [ -z "${port}" ]; then
  540. port="2302"
  541. fi
  542. {
  543. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  544. echo -e "> Game\tINBOUND\t${port}\tudp"
  545. # Don't do arithmetics if ever the port wasn't a numeric value
  546. if [ "${port}" -eq "${port}" ]; then
  547. echo -e "> Steam: Query\tINBOUND\t$((port+1))\tudp"
  548. echo -e "> Steam: Master traffic\tINBOUND\t$((port+2))\tudp"
  549. echo -e "> Undocumented Port\tINBOUND\t$((port+3))\tudp"
  550. fi
  551. } | column -s $'\t' -t
  552. }
  553. fn_info_message_refractor(){
  554. echo -e "netstat -atunp | grep bf1942_lnxd"
  555. echo -e ""
  556. {
  557. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  558. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  559. echo -e "> Steam: Query\tINBOUND\t${queryport}\tudp"
  560. } | column -s $'\t' -t
  561. }
  562. fn_info_message_rust(){
  563. echo -e "netstat -atunp | grep Rust"
  564. echo -e ""
  565. {
  566. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  567. echo -e "> Game/Query\tINBOUND\t${port}\ttcp/udp"
  568. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  569. } | column -s $'\t' -t
  570. }
  571. fn_info_message_seriousengine35(){
  572. echo -e "netstat -atunp | grep Sam3_Dedicate"
  573. echo -e ""
  574. {
  575. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  576. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp"
  577. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  578. } | column -s $'\t' -t
  579. }
  580. fn_info_message_sdtd(){
  581. echo -e "netstat -atunp | grep 7DaysToDie"
  582. echo -e ""
  583. {
  584. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  585. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  586. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  587. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
  588. echo -e "> Telnet\tINBOUND\t${telnetport}\ttcp"
  589. } | column -s $'\t' -t
  590. echo -e ""
  591. echo -e "${lightgreen}${servername} WebAdmin${default}"
  592. fn_messages_separator
  593. {
  594. echo -e "${blue}WebAdmin enabled:\t${default}${webadminenabled}"
  595. echo -e "${blue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
  596. echo -e "${blue}WebAdmin password:\t${default}${webadminpass}"
  597. } | column -s $'\t' -t
  598. echo -e ""
  599. echo -e "${lightgreen}${servername} Telnet${default}"
  600. fn_messages_separator
  601. {
  602. echo -e "${blue}Telnet enabled:\t${default}${telnetenabled}"
  603. echo -e "${blue}Telnet address:\t${default}${ip} ${telnetport}"
  604. echo -e "${blue}Telnet password:\t${default}${telnetpass}"
  605. } | column -s $'\t' -t
  606. }
  607. fn_info_message_source(){
  608. echo -e "netstat -atunp | grep srcds_linux"
  609. echo -e ""
  610. {
  611. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  612. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
  613. echo -e "> SourceTV\tINBOUND\t${sourcetvport}\tudp"
  614. echo -e "< Client\tOUTBOUND\t${clientport}\tudp"
  615. } | column -s $'\t' -t
  616. }
  617. fn_info_message_spark(){
  618. echo -e "netstat -atunp | grep server_linux3"
  619. echo -e ""
  620. {
  621. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  622. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  623. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  624. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
  625. } | column -s $'\t' -t
  626. echo -e ""
  627. echo -e "${lightgreen}${servername} WebAdmin${default}"
  628. fn_messages_separator
  629. {
  630. echo -e "${blue}WebAdmin url:\t${default}http://${ip}:${webadminport}/index.html"
  631. echo -e "${blue}WebAdmin username:\t${default}${webadminuser}"
  632. echo -e "${blue}WebAdmin password:\t${default}${webadminpass}"
  633. } | column -s $'\t' -t
  634. }
  635. fn_info_message_squad(){
  636. echo -e "netstat -atunp | grep SquadServer"
  637. echo -e ""
  638. {
  639. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  640. echo -e "> Game\tINBOUND\t${port}\tudp"
  641. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  642. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  643. } | column -s $'\t' -t
  644. }
  645. fn_info_message_starbound(){
  646. echo -e "netstat -atunp | grep starbound"
  647. echo -e ""
  648. {
  649. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  650. echo -e "> Game\tINBOUND\t${port}\ttcp"
  651. echo -e "> Query\tINBOUND\t${queryport}\ttcp"
  652. echo -e "> Rcon\tINBOUND\t${rconport}\ttcp"
  653. } | column -s $'\t' -t
  654. }
  655. fn_info_message_teamspeak3(){
  656. echo -e "netstat -atunp | grep ts3server"
  657. echo -e ""
  658. {
  659. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  660. echo -e "> Voice\tINBOUND\t${port}\tudp"
  661. echo -e "> ServerQuery\tINBOUND\t${queryport}\ttcp"
  662. echo -e "> File transfer\tINBOUND\t${fileport}\ttcp"
  663. } | column -s $'\t' -t
  664. }
  665. fn_info_message_teeworlds(){
  666. echo -e "netstat -atunp | grep teeworlds_srv"
  667. echo -e ""
  668. {
  669. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  670. echo -e "> Game\tINBOUND\t${port}\ttcp"
  671. } | column -s $'\t' -t
  672. }
  673. fn_info_message_terraria(){
  674. echo -e "netstat -atunp | grep TerrariaServer"
  675. echo -e ""
  676. {
  677. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  678. echo -e "> Game\tINBOUND\t${port}\ttcp"
  679. } | column -s $'\t' -t
  680. }
  681. fn_info_message_towerunite(){
  682. echo -e "netstat -atunp | grep TowerServer"
  683. echo -e ""
  684. {
  685. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  686. echo -e "> Game\tINBOUND\t${port}\ttcp"
  687. # Don't do arithmetics if ever the port wasn't a numeric value
  688. if [ "${port}" -eq "${port}" ]; then
  689. echo -e "> Steam\tINBOUND\t$((port+1))\tudp"
  690. fi
  691. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  692. } | column -s $'\t' -t
  693. }
  694. fn_info_message_unreal(){
  695. echo -e "netstat -atunp | grep ucc-bin"
  696. echo -e ""
  697. {
  698. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL\tINI VARIABLE"
  699. echo -e "> Game\tINBOUND\t${port}\tudp\tPort=${port}"
  700. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  701. if [ "${engine}" == "unreal" ]; then
  702. echo -e "< UdpLink Port (random)\tOUTBOUND\t${udplinkport}+\tudp"
  703. fi
  704. if [ "${engine}" != "unreal" ] && [ "${appid}" != "223250" ]; then
  705. echo -e "> GameSpy query\tINBOUND\t${gsqueryport}\tudp\tOldQueryPortNumber=${gsqueryport}"
  706. fi
  707. if [ "${appid}" == "215360" ]; then
  708. echo -e "< Master server\tOUTBOUND\t28852\ttcp/udp"
  709. else
  710. echo -e "< Master server\tOUTBOUND\t28900/28902\ttcp/udp"
  711. fi
  712. if [ "${appid}" ]; then
  713. if [ "${appid}" == "223250" ]; then
  714. echo -e "< Steam\tOUTBOUND\t20610\tudp"
  715. else
  716. echo -e "< Steam\tOUTBOUND\t20660\tudp"
  717. fi
  718. fi
  719. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp\tListenPort=${webadminport}"
  720. } | column -s $'\t' -t
  721. echo -e ""
  722. echo -e "${lightgreen}${servername} WebAdmin${default}"
  723. fn_messages_separator
  724. {
  725. echo -e "${blue}WebAdmin enabled:\t${default}${webadminenabled}"
  726. echo -e "${blue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
  727. echo -e "${blue}WebAdmin username:\t${default}${webadminuser}"
  728. echo -e "${blue}WebAdmin password:\t${default}${webadminpass}"
  729. } | column -s $'\t' -t
  730. }
  731. fn_info_message_ut3(){
  732. echo -e "netstat -atunp | grep ut3-bin"
  733. echo -e ""
  734. {
  735. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  736. echo -e "> Game/Query\tINBOUND\t${port}\ttcp/udp"
  737. } | column -s $'\t' -t
  738. }
  739. fn_info_message_wolfensteinenemyterritory(){
  740. echo -e "netstat -atunp | grep etded"
  741. echo -e ""
  742. {
  743. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  744. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  745. } | column -s $'\t' -t
  746. }
  747. fn_info_message_mta(){
  748. echo -e "netstat -atunp | grep mta-server64"
  749. echo -e ""
  750. {
  751. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  752. echo -e "> Game\tOUTBOUND\t${port}\tudp"
  753. echo -e "> HTTP Server\tINBOUND\t${httpport}\ttcp"
  754. if [ "${ase}" == "Enabled" ]; then
  755. echo -e "> ASE Game_Monitor\tOUTBOUND\t$((${port} + 123))\tudp"
  756. fi
  757. } | column -s $'\t' -t
  758. }
  759. fn_info_message_select_engine(){
  760. # Display details depending on game or engine.
  761. if [ "${engine}" == "avalanche" ]; then
  762. fn_info_message_avalanche
  763. elif [ "${engine}" == "refractor" ]; then
  764. fn_info_message_refractor
  765. elif [ "${engine}" == "dontstarve" ]; then
  766. fn_info_message_dontstarve
  767. elif [ "${engine}" == "goldsource" ]; then
  768. fn_info_message_goldsource
  769. elif [ "${engine}" == "lwjgl2" ]; then
  770. fn_info_message_minecraft
  771. elif [ "${engine}" == "projectzomboid" ]; then
  772. fn_info_message_projectzomboid
  773. elif [ "${engine}" == "realvirtuality" ]; then
  774. fn_info_message_realvirtuality
  775. elif [ "${engine}" == "seriousengine35" ]; then
  776. fn_info_message_seriousengine35
  777. elif [ "${engine}" == "source" ]; then
  778. fn_info_message_source
  779. elif [ "${engine}" == "spark" ]; then
  780. fn_info_message_spark
  781. elif [ "${engine}" == "starbound" ]; then
  782. fn_info_message_starbound
  783. elif [ "${engine}" == "teeworlds" ]; then
  784. fn_info_message_teeworlds
  785. elif [ "${engine}" == "terraria" ]; then
  786. fn_info_message_terraria
  787. elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
  788. fn_info_message_unreal
  789. elif [ "${engine}" == "unreal3" ]; then
  790. fn_info_message_ut3
  791. elif [ "${gamename}" == "7 Days To Die" ]; then
  792. fn_info_message_sdtd
  793. elif [ "${gamename}" == "ARK: Survival Evolved" ]; then
  794. fn_info_message_ark
  795. elif [ "${gamename}" == "Ballistic Overkill" ]; then
  796. fn_info_message_ballisticoverkill
  797. elif [ "${gamename}" == "Call of Duty" ]; then
  798. fn_info_message_cod
  799. elif [ "${gamename}" == "Call of Duty: United Offensive" ]; then
  800. fn_info_message_coduo
  801. elif [ "${gamename}" == "Call of Duty 2" ]; then
  802. fn_info_message_cod2
  803. elif [ "${gamename}" == "Call of Duty 4" ]; then
  804. fn_info_message_cod4
  805. elif [ "${gamename}" == "Call of Duty: World at War" ]; then
  806. fn_info_message_codwaw
  807. elif [ "${gamename}" == "Factorio" ]; then
  808. fn_info_message_factorio
  809. elif [ "${gamename}" == "Hurtworld" ]; then
  810. fn_info_message_hurtworld
  811. elif [ "${gamename}" == "Project Cars" ]; then
  812. fn_info_message_projectcars
  813. elif [ "${gamename}" == "QuakeWorld" ]; then
  814. fn_info_message_quake
  815. elif [ "${gamename}" == "Quake 2" ]; then
  816. fn_info_message_quake2
  817. elif [ "${gamename}" == "Quake 3: Arena" ]; then
  818. fn_info_message_quake3
  819. elif [ "${gamename}" == "Quake Live" ]; then
  820. fn_info_message_quakelive
  821. elif [ "${gamename}" == "Squad" ]; then
  822. fn_info_message_squad
  823. elif [ "${gamename}" == "TeamSpeak 3" ]; then
  824. fn_info_message_teamspeak3
  825. elif [ "${gamename}" == "Tower Unite" ]; then
  826. fn_info_message_towerunite
  827. elif [ "${gamename}" == "Multi Theft Auto" ]; then
  828. fn_info_message_mta
  829. elif [ "${gamename}" == "Mumble" ]; then
  830. fn_info_message_mumble
  831. elif [ "${gamename}" == "Rust" ]; then
  832. fn_info_message_rust
  833. elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
  834. fn_info_message_wolfensteinenemyterritory
  835. else
  836. fn_print_error_nl "Unable to detect server engine."
  837. fi
  838. }
  839. # Separator is different for details
  840. fn_messages_separator(){
  841. if [ "${function_selfname}" == "command_details.sh" ]; then
  842. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  843. else
  844. echo -e "================================="
  845. fi
  846. }