info_messages.sh 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555
  1. #!/bin/bash
  2. # LinuxGSM info_messages.sh function
  3. # Author: Daniel Gibbs
  4. # Website: https://linuxgsm.com
  5. # Description: Defines server info messages for details and alerts.
  6. functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
  7. # Standard Details
  8. # This applies to all engines
  9. fn_info_message_head(){
  10. echo -e ""
  11. echo -e "${lightyellow}Summary${default}"
  12. fn_messages_separator
  13. echo -e "Message"
  14. echo -e "${alertbody}"
  15. echo -e ""
  16. echo -e "Game"
  17. echo -e "${gamename}"
  18. echo -e ""
  19. echo -e "Server name"
  20. echo -e "${servername}"
  21. echo -e ""
  22. echo -e "Hostname"
  23. echo -e "${HOSTNAME}"
  24. echo -e ""
  25. echo -e "Server IP"
  26. if [ "${multiple_ip}" == "1" ]; then
  27. echo -e "NOT SET"
  28. else
  29. echo -e "${ip}:${port}"
  30. fi
  31. }
  32. fn_info_message_distro(){
  33. #
  34. # Distro Details
  35. # =====================================
  36. # Distro: Ubuntu 14.04.4 LTS
  37. # Arch: x86_64
  38. # Kernel: 3.13.0-79-generic
  39. # Hostname: hostname
  40. # tmux: tmux 1.8
  41. # glibc: 2.19
  42. echo -e ""
  43. echo -e "${lightyellow}Distro Details${default}"
  44. fn_messages_separator
  45. {
  46. echo -e "${lightblue}Distro:\t${default}${distroname}"
  47. echo -e "${lightblue}Arch:\t${default}${arch}"
  48. echo -e "${lightblue}Kernel:\t${default}${kernel}"
  49. echo -e "${lightblue}Hostname:\t${default}${HOSTNAME}"
  50. echo -e "${lightblue}Uptime:\t${default}${days}d, ${hours}h, ${minutes}m"
  51. echo -e "${lightblue}tmux:\t${default}${tmuxv}"
  52. echo -e "${lightblue}glibc:\t${default}${glibcversion}"
  53. } | column -s $'\t' -t
  54. }
  55. fn_info_message_server_resource(){
  56. #
  57. # Server Resource
  58. # ==========================================================================================================================================================================================================================================
  59. # CPU
  60. # Model: Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
  61. # Cores: 4
  62. # Frequency: 2499.994 MHz
  63. # Avg Load: 0.20, 0.08, 0.01
  64. #
  65. # Memory
  66. # Mem: total used free cached available
  67. # Physical: 7.8GB 598MB 7.0GB 4.0GB 7.0GB
  68. # Swap: 512MB 0B 512MB
  69. #
  70. # Storage
  71. # Filesystem: /dev/sda
  72. # Total: 157G
  73. # Used: 138G
  74. # Available: 12G
  75. echo -e ""
  76. echo -e "${lightyellow}Server Resource${default}"
  77. fn_messages_separator
  78. {
  79. echo -e "${lightyellow}CPU\t${default}"
  80. echo -e "${lightblue}Model:\t${default}${cpumodel}"
  81. echo -e "${lightblue}Cores:\t${default}${cpucores}"
  82. echo -e "${lightblue}Frequency:\t${default}${cpufreqency}MHz"
  83. echo -e "${lightblue}Avg Load:\t${default}${load}"
  84. } | column -s $'\t' -t
  85. echo -e ""
  86. {
  87. echo -e "${lightyellow}Memory\t${default}"
  88. echo -e "${lightblue}Mem:\t${lightblue}total\tused\tfree\tcached\tavailable${default}"
  89. echo -e "${lightblue}Physical:\t${default}${physmemtotal}\t${physmemused}\t${physmemfree}\t${physmemcached}\t${physmemavailable}${default}"
  90. echo -e "${lightblue}Swap:\t${default}${swaptotal}\t${swapused}\t${swapfree}${default}"
  91. } | column -s $'\t' -t
  92. echo -e ""
  93. {
  94. echo -e "${lightyellow}Storage${default}"
  95. echo -e "${lightblue}Filesystem:\t${default}${filesystem}"
  96. echo -e "${lightblue}Total:\t\t${default}${totalspace}"
  97. echo -e "${lightblue}Used:\t\t${default}${usedspace}"
  98. echo -e "${lightblue}Available:\t${default}${availspace}"
  99. } | column -s $'\t' -t
  100. echo -e ""
  101. {
  102. echo -e "${lightyellow}Network${default}"
  103. if [ -n "${netint}" ]; then
  104. echo -e "${lightblue}Interface:\t${default}${netint}"
  105. fi
  106. if [ -n "${netlink}" ]; then
  107. echo -e "${lightblue}Link Speed:\t${default}${netlink}"
  108. fi
  109. echo -e "${lightblue}IP:\t${default}${ip}"
  110. if [ "${ip}" != "${extip}" ]; then
  111. echo -e "${lightblue}Internet IP:\t${default}${extip}"
  112. fi
  113. } | column -s $'\t' -t
  114. }
  115. fn_info_message_gameserver_resource(){
  116. # Game Server Resource Usage
  117. # ==========================================================================================================================================================================================================================================
  118. # CPU Used: 2.5%
  119. # Mem Used: 2.1% 171MB
  120. #
  121. # Storage
  122. # Total: 21G
  123. # Serverfiles: 20G
  124. # Backups: 20K
  125. echo -e ""
  126. echo -e "${lightyellow}Game Server Resource Usage${default}"
  127. fn_messages_separator
  128. {
  129. if [ "${status}" == "1" ]; then
  130. echo -e "${lightblue}CPU Used:\t${default}${cpuused}%${default}"
  131. echo -e "${lightblue}Mem Used:\t${default}${pmemused}%\t${memused}MB${default}"
  132. else
  133. echo -e "${lightblue}CPU Used:\t${default}0%${default}"
  134. echo -e "${lightblue}Mem Used:\t${default}0%\t0MB${default}"
  135. fi
  136. } | column -s $'\t' -t
  137. echo -e ""
  138. {
  139. echo -e "${lightyellow}Storage${default}"
  140. echo -e "${lightblue}Total:\t${default}${rootdirdu}"
  141. echo -e "${lightblue}Serverfiles:\t${default}${serverfilesdu}"
  142. if [ -d "${backupdir}" ]; then
  143. echo -e "${lightblue}Backups:\t${default}${backupdirdu}"
  144. fi
  145. } | column -s $'\t' -t
  146. }
  147. fn_info_message_gameserver(){
  148. # Counter-Strike: Global Offensive Server Details
  149. # ==========================================================================================================================================================================================================================================
  150. # Server name: LinuxGSM
  151. # Server IP: 80.70.189.230:27015
  152. # Server password: NOT SET
  153. # RCON password: adminF54CC0VR
  154. # Players: 0/16
  155. # Current map: de_mirage
  156. # Default map: de_mirage
  157. # Game type: 0
  158. # Game mode: 0
  159. # Tick rate: 64
  160. # Master Server: true
  161. # Status: ONLINE
  162. echo -e ""
  163. echo -e "${lightgreen}${gamename} Server Details${default}"
  164. fn_info_message_password_strip
  165. fn_messages_separator
  166. {
  167. # Server name
  168. if [ -n "${gdname}" ]; then
  169. echo -e "${lightblue}Server name:\t${default}${gdname}"
  170. elif [ -n "${servername}" ]; then
  171. echo -e "${lightblue}Server name:\t${default}${servername}"
  172. fi
  173. # Server description
  174. if [ -n "${serverdescription}" ]; then
  175. echo -e "${lightblue}Server Description:\t${default}${serverdescription}"
  176. fi
  177. # Branch
  178. if [ -n "${branch}" ]; then
  179. echo -e "${lightblue}Branch:\t${default}${branch}"
  180. fi
  181. # Server ip
  182. if [ "${multiple_ip}" == "1" ]; then
  183. echo -e "${lightblue}Server IP:\t${default}NOT SET"
  184. else
  185. echo -e "${lightblue}Server IP:\t${default}${ip}:${port}"
  186. fi
  187. # Internet ip
  188. if [ -n "${extip}" ]; then
  189. if [ "${ip}" != "${extip}" ]; then
  190. echo -e "${lightblue}Internet IP:\t${default}${extip}:${port}"
  191. fi
  192. fi
  193. # Display ip
  194. if [ -n "${displayip}" ]; then
  195. echo -e "${lightblue}Display IP:\t${default}${displayip}:${port}"
  196. fi
  197. # Server password
  198. if [ -n "${serverpassword}" ]; then
  199. echo -e "${lightblue}Server password:\t${default}${serverpassword}"
  200. fi
  201. # Query enabled (Starbound)
  202. if [ -n "${queryenabled}" ]; then
  203. echo -e "${lightblue}Query enabled:\t${default}${queryenabled}"
  204. fi
  205. # RCON enabled (Starbound)
  206. if [ -n "${rconenabled}" ]; then
  207. echo -e "${lightblue}RCON enabled:\t${default}${rconenabled}"
  208. fi
  209. # RCON password
  210. if [ -n "${rconpassword}" ]; then
  211. echo -e "${lightblue}RCON password:\t${default}${rconpassword}"
  212. fi
  213. # RCON web (Rust)
  214. if [ -n "${rconweb}" ]; then
  215. echo -e "${lightblue}RCON web:\t${default}${rconweb}"
  216. fi
  217. # Admin password
  218. if [ -n "${adminpassword}" ]; then
  219. echo -e "${lightblue}Admin password:\t${default}${adminpassword}"
  220. fi
  221. # Stats password (Quake Live)
  222. if [ -n "${statspassword}" ]; then
  223. echo -e "${lightblue}Stats password:\t${default}${statspassword}"
  224. fi
  225. # Players
  226. if [ "${querystatus}" != "0" ]; then
  227. if [ -n "${maxplayers}" ]; then
  228. echo -e "${lightblue}Maxplayers:\t${default}${maxplayers}"
  229. fi
  230. else
  231. if [ -n "${gdplayers}" ]&&[ -n "${gdmaxplayers}" ]; then
  232. echo -e "${lightblue}Players:\t${default}${gdplayers}/${gdmaxplayers}"
  233. elif [ -n "${gdplayers}" ]&&[ -n "${maxplayers}" ]; then
  234. echo -e "${lightblue}Players:\t${default}${gdplayers}/${maxplayers}"
  235. elif [ -z "${gdplayers}" ]&&[ -n "${gdmaxplayers}" ]; then
  236. echo -e "${lightblue}Players:\t${default}0/${gdmaxplayers}"
  237. elif [ -n "${gdplayers}" ]&&[ -z "${gdmaxplayers}" ]; then
  238. echo -e "${lightblue}Players:\t${default}${gdplayers}/∞"
  239. elif [ -z "${gdplayers}" ]&&[ -z "${gdmaxplayers}" ]&&[ -n "${maxplayers}" ]; then
  240. echo -e "${lightblue}Maxplayers:\t${default}${maxplayers}"
  241. fi
  242. fi
  243. # Bots
  244. if [ -n "${gdbots}" ]; then
  245. echo -e "${lightblue}Bots:\t${default}${gdbots}"
  246. fi
  247. # Current map
  248. if [ -n "${gdmap}" ]; then
  249. echo -e "${lightblue}Current map:\t${default}${gdmap}"
  250. fi
  251. # Default map
  252. if [ -n "${defaultmap}" ]; then
  253. echo -e "${lightblue}Default map:\t${default}${defaultmap}"
  254. fi
  255. if [ -n "${defaultscenario}" ]; then
  256. # Current scenario
  257. if [ -n "${gdgamemode}" ]; then
  258. echo -e "${lightblue}Current scenario:\t${default}${gdgamemode}"
  259. fi
  260. else
  261. # Current game mode
  262. if [ -n "${gdgamemode}" ]; then
  263. echo -e "${lightblue}Current game mode:\t${default}${gdgamemode}"
  264. fi
  265. fi
  266. # Default scenario
  267. if [ -n "${defaultscenario}" ]; then
  268. echo -e "${lightblue}Default scenario:\t${default}${defaultscenario}"
  269. fi
  270. # Game type
  271. if [ -n "${gametype}" ]; then
  272. echo -e "${lightblue}Game type:\t${default}${gametype}"
  273. fi
  274. # Game mode
  275. if [ -n "${gamemode}" ]; then
  276. echo -e "${lightblue}Game mode:\t${default}${gamemode}"
  277. fi
  278. # Game world
  279. if [ -n "${gameworld}" ]; then
  280. echo -e "${lightblue}Game world:\t${default}${gameworld}"
  281. fi
  282. # Tick rate
  283. if [ -n "${tickrate}" ]; then
  284. echo -e "${lightblue}Tick rate:\t${default}${tickrate}"
  285. fi
  286. # Sharding (Don't Starve Together)
  287. if [ -n "${sharding}" ]; then
  288. echo -e "${lightblue}Sharding:\t${default}${sharding}"
  289. fi
  290. # Master (Don't Starve Together)
  291. if [ -n "${master}" ]; then
  292. echo -e "${lightblue}Master:\t${default}${master}"
  293. fi
  294. # Shard (Don't Starve Together)
  295. if [ -n "${shard}" ]; then
  296. echo -e "${lightblue}Shard:\t${default}${shard}"
  297. fi
  298. # Cluster (Don't Starve Together)
  299. if [ -n "${cluster}" ]; then
  300. echo -e "${lightblue}Cluster:\t${default}${cluster}"
  301. fi
  302. # Cave (Don't Starve Together)
  303. if [ -n "${cave}" ]; then
  304. echo -e "${lightblue}Cave:\t${default}${cave}"
  305. fi
  306. # Creativemode (Hurtworld)
  307. if [ -n "${creativemode}" ]; then
  308. echo -e "${lightblue}Creativemode:\t${default}${creativemode}"
  309. fi
  310. # TeamSpeak dbplugin
  311. if [ -n "${dbplugin}" ]; then
  312. echo -e "${lightblue}dbplugin:\t${default}${dbplugin}"
  313. fi
  314. # ASE (Multi Theft Auto)
  315. if [ -n "${ase}" ]; then
  316. echo -e "${lightblue}ASE:\t${default}${ase}"
  317. fi
  318. # Save interval (Rust)
  319. if [ -n "${saveinterval}" ]; then
  320. echo -e "${lightblue}ASE:\t${default}${saveinterval} s"
  321. fi
  322. # Random map rotation mode (Squad and Post Scriptum)
  323. if [ -n "${randommap}" ]; then
  324. echo -e "${lightblue}Map rotation:\t${default}${randommap}"
  325. fi
  326. # Listed on Master server
  327. if [ -n "${displaymasterserver}" ]; then
  328. if [ "${displaymasterserver}" == "true" ]; then
  329. echo -e "${lightblue}Master server:\t${green}${displaymasterserver}${default}"
  330. else
  331. echo -e "${lightblue}Master server:\t${red}${displaymasterserver}${default}"
  332. fi
  333. fi
  334. # Online status
  335. if [ "${status}" == "0" ]; then
  336. echo -e "${lightblue}Status:\t${red}OFFLINE${default}"
  337. else
  338. echo -e "${lightblue}Status:\t${green}ONLINE${default}"
  339. fi
  340. } | column -s $'\t' -t
  341. echo -e ""
  342. }
  343. fn_info_message_script(){
  344. #
  345. # csgoserver Script Details
  346. #==========================================================================================================================================================================================================================================
  347. # Script name: csgoserver
  348. # LinuxGSM version: v19.9.0
  349. # glibc required: 2.15
  350. # Discord alert: off
  351. # Slack alert: off
  352. # Email alert: off
  353. # Pushbullet alert: off
  354. # IFTTT alert: off
  355. # Mailgun (email) alert: off
  356. # Pushover alert: off
  357. # Telegram alert: off
  358. # Update on start: off
  359. # User: lgsm
  360. # Location: /home/lgsm/csgoserver
  361. # Config file: /home/lgsm/csgoserver/serverfiles/csgo/cfg/csgoserver.cfg
  362. echo -e "${lightgreen}${selfname} Script Details${default}"
  363. fn_messages_separator
  364. {
  365. # Script name
  366. echo -e "${lightblue}Script name:\t${default}${selfname}"
  367. # LinuxGSM version
  368. if [ -n "${version}" ]; then
  369. echo -e "${lightblue}LinuxGSM version:\t${default}${version}"
  370. fi
  371. # glibc required
  372. if [ -n "${glibc}" ]; then
  373. if [ "${glibc}" == "null" ]; then
  374. # Glibc is not required.
  375. :
  376. elif [ -z "${glibc}" ]; then
  377. echo -e "${lightblue}glibc required:\t${red}UNKNOWN${default}"
  378. elif [ "$(printf '%s\n'${glibc}'\n' ${glibcversion} | sort -V | head -n 1)" != "${glibc}" ]; then
  379. echo -e "${lightblue}glibc required:\t${red}${glibc} ${default}(${red}distro glibc ${glibcversion} too old${default})"
  380. else
  381. echo -e "${lightblue}glibc required:\t${green}${glibc}${default}"
  382. fi
  383. fi
  384. # Discord alert
  385. echo -e "${lightblue}Discord alert:\t${default}${discordalert}"
  386. # Slack alert
  387. echo -e "${lightblue}Slack alert:\t${default}${slackalert}"
  388. # Email alert
  389. echo -e "${lightblue}Email alert:\t${default}${emailalert}"
  390. # Pushbullet alert
  391. echo -e "${lightblue}Pushbullet alert:\t${default}${pushbulletalert}"
  392. # IFTTT alert
  393. echo -e "${lightblue}IFTTT alert:\t${default}${iftttalert}"
  394. # Mailgun alert
  395. echo -e "${lightblue}Mailgun (email) alert:\t${default}${mailgunalert}"
  396. # Pushover alert
  397. echo -e "${lightblue}Pushover alert:\t${default}${pushoveralert}"
  398. # Telegram alert
  399. echo -e "${lightblue}Telegram alert:\t${default}${telegramalert}"
  400. # Update on start
  401. if [ -n "${updateonstart}" ]; then
  402. echo -e "${lightblue}Update on start:\t${default}${updateonstart}"
  403. fi
  404. # User
  405. echo -e "${lightblue}User:\t${default}$(whoami)"
  406. # Script location
  407. echo -e "${lightblue}Location:\t${default}${rootdir}"
  408. # Config file location
  409. if [ -n "${servercfgfullpath}" ]; then
  410. if [ -f "${servercfgfullpath}" ]; then
  411. echo -e "${lightblue}Config file:\t${default}${servercfgfullpath}"
  412. elif [ -d "${servercfgfullpath}" ]; then
  413. echo -e "${lightblue}Config dir:\t${default}${servercfgfullpath}"
  414. else
  415. echo -e "${lightblue}Config file:\t${default}${red}${servercfgfullpath}${default} (${red}FILE MISSING${default})"
  416. fi
  417. fi
  418. # Network config file location (ARMA 3)
  419. if [ -n "${networkcfgfullpath}" ]; then
  420. echo -e "${lightblue}Network config file:\t${default}${networkcfgfullpath}"
  421. fi
  422. } | column -s $'\t' -t
  423. }
  424. fn_info_message_backup(){
  425. #
  426. # Backups
  427. # =====================================
  428. # No. of backups: 1
  429. # Latest backup:
  430. # date: Fri May 6 18:34:19 UTC 2016
  431. # file: /home/lgsm/qlserver/backups/ql-server-2016-05-06-183239.tar.gz
  432. # size: 945M
  433. echo -e ""
  434. echo -e "${lightgreen}Backups${default}"
  435. fn_messages_separator
  436. if [ ! -d "${backupdir}" ]||[ "${backupcount}" == "0" ]; then
  437. echo -e "No Backups created"
  438. else
  439. {
  440. echo -e "${lightblue}No. of backups:\t${default}${backupcount}"
  441. echo -e "${lightblue}Latest backup:${default}"
  442. if [ "${lastbackupdaysago}" == "0" ]; then
  443. echo -e "${lightblue} date:\t${default}${lastbackupdate} (less than 1 day ago)"
  444. elif [ "${lastbackupdaysago}" == "1" ]; then
  445. echo -e "${lightblue} date:\t${default}${lastbackupdate} (1 day ago)"
  446. else
  447. echo -e "${lightblue} date:\t${default}${lastbackupdate} (${lastbackupdaysago} days ago)"
  448. fi
  449. echo -e "${lightblue} file:\t${default}${lastbackup}"
  450. echo -e "${lightblue} size:\t${default}${lastbackupsize}"
  451. } | column -s $'\t' -t
  452. fi
  453. }
  454. fn_info_message_commandlineparms(){
  455. #
  456. # Command-line Parameters
  457. # =====================================
  458. # ./run_server_x86.sh +set net_strict 1
  459. echo -e ""
  460. echo -e "${lightgreen}Command-line Parameters${default}"
  461. fn_info_message_password_strip
  462. fn_messages_separator
  463. if [ "${serverpassword}" == "NOT SET" ]; then
  464. unset serverpassword
  465. fi
  466. fn_parms
  467. echo -e "${executable} ${parms}"
  468. }
  469. fn_info_message_ports(){
  470. # Ports
  471. # =====================================
  472. # Change ports by editing the parameters in:
  473. # /home/lgsm/qlserver/serverfiles/baseq3/ql-server.cfg
  474. echo -e ""
  475. echo -e "${lightgreen}Ports${default}"
  476. fn_messages_separator
  477. echo -e "${lightblue}Change ports by editing the parameters in:${default}"
  478. parmslocation="${red}UNKNOWN${default}"
  479. # engines/games that require editing in the config file.
  480. local ports_edit_array=( "avalanche2.0" "avalanche3.0" "Ballistic Overkill" "dontstarve" "Eco" "idtech2" "idtech3" "idtech3_ql" "lwjgl2" "Minecraft Bedrock" "Project Cars" "projectzomboid" "quake" "refractor" "realvirtuality" "renderware" "seriousengine35" "Stationeers" "teeworlds" "terraria" "unreal" "unreal2" "unreal3" "TeamSpeak 3" "Mumble" "7 Days To Die" "wurm")
  481. for port_edit in "${ports_edit_array[@]}"
  482. do
  483. if [ "${shortname}" == "ut3" ]; then
  484. parmslocation="${servercfgdir}/UTWeb.ini"
  485. elif [ "${shortname}" == "kf2" ]; then
  486. parmslocation="${servercfgdir}/LinuxServer-KFEngine.ini\n${servercfgdir}/KFWeb.ini"
  487. elif [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]; then
  488. parmslocation="${servercfgfullpath}"
  489. fi
  490. done
  491. # engines/games that require editing the parms.
  492. local ports_edit_array=( "Avorion" "goldsrc" "Factorio" "Hurtworld" "iw3.0" "ioquake3" "qfusion" "Rust" "Soldat" "spark" "source" "starbound" "unreal4" "realvirtuality" "Unturned" )
  493. for port_edit in "${ports_edit_array[@]}"
  494. do
  495. if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]||[ "${shortname}" == "${port_edit}" ]; then
  496. parmslocation="${configdirserver}"
  497. fi
  498. done
  499. echo -e "${parmslocation}"
  500. echo -e ""
  501. echo -e "${lightblue}Useful port diagnostic command:${default}"
  502. }
  503. fn_info_message_statusbottom(){
  504. echo -e ""
  505. if [ "${status}" == "0" ]; then
  506. echo -e "${lightblue}Status:\t${red}OFFLINE${default}"
  507. else
  508. echo -e "${lightblue}Status:\t${green}ONLINE${default}"
  509. fi
  510. echo -e ""
  511. }
  512. fn_info_logs(){
  513. echo -e ""
  514. echo -e "${selfname} Logs"
  515. echo -e "================================="
  516. if [ -n "${lgsmlog}" ]; then
  517. echo -e "\nScript log\n==================="
  518. if [ ! "$(ls -A "${lgsmlogdir}")" ]; then
  519. echo -e "${lgsmlogdir} (NO LOG FILES)"
  520. elif [ ! -s "${lgsmlog}" ]; then
  521. echo -e "${lgsmlog} (LOG FILE IS EMPTY)"
  522. else
  523. echo -e "${lgsmlog}"
  524. tail -25 "${lgsmlog}"
  525. fi
  526. echo -e ""
  527. fi
  528. if [ -n "${consolelog}" ]; then
  529. echo -e "\nConsole log\n===================="
  530. if [ ! "$(ls -A "${consolelogdir}")" ]; then
  531. echo -e "${consolelogdir} (NO LOG FILES)"
  532. elif [ ! -s "${consolelog}" ]; then
  533. echo -e "${consolelog} (LOG FILE IS EMPTY)"
  534. else
  535. echo -e "${consolelog}"
  536. tail -25 "${consolelog}" | awk '{ sub("\r$", ""); print }'
  537. fi
  538. echo -e ""
  539. fi
  540. if [ -n "${gamelogdir}" ]; then
  541. echo -e "\nServer log\n==================="
  542. if [ ! "$(ls -A "${gamelogdir}")" ]; then
  543. echo -e "${gamelogdir} (NO LOG FILES)"
  544. else
  545. echo -e "${gamelogdir}"
  546. # dos2unix sed 's/\r//'
  547. tail "${gamelogdir}"/* 2>/dev/null | grep -v "==>" | sed '/^$/d' | sed 's/\r//' | tail -25
  548. fi
  549. echo -e ""
  550. fi
  551. }
  552. # Engine/Game Specific details
  553. fn_info_message_assettocorsa(){
  554. echo -e "netstat -atunp| grep acServer"
  555. echo -e ""
  556. {
  557. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  558. echo -e "> Game\tINBOUND\t${port}\tudp"
  559. echo -e "> HTTP\tINBOUND\t${port}\tudp"
  560. } | column -s $'\t' -t
  561. }
  562. fn_info_message_ark(){
  563. echo -e "netstat -atunp | grep ShooterGame"
  564. echo -e ""
  565. {
  566. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  567. echo -e "> Game\tINBOUND\t${port}\tudp"
  568. # Don't do arithmetics if ever the port wasn't a numeric value
  569. if [ "${port}" -eq "${port}" ]; then
  570. echo -e "> RAW\tINBOUND\t$((port+1))\tudp"
  571. fi
  572. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  573. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  574. } | column -s $'\t' -t
  575. }
  576. fn_info_message_avorion() {
  577. echo "netstat -atunp | grep Avorion"
  578. echo -e ""
  579. {
  580. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  581. echo -e "> Game\tINBOUND\t${port}\tudp"
  582. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  583. } | column -s $'\t' -t
  584. }
  585. fn_info_message_ballisticoverkill(){
  586. echo -e "netstat -atunp | grep BODS.x86"
  587. echo -e ""
  588. {
  589. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  590. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  591. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  592. } | column -s $'\t' -t
  593. }
  594. fn_info_message_battalion1944(){
  595. echo -e "netstat -atunp | grep BattalionServ"
  596. echo -e ""
  597. {
  598. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  599. echo -e "> Game\tINBOUND\t${port}\tudp"
  600. # Don't do arithmetics if ever the port wasn't a numeric value
  601. # unconfirmed - http://wiki.battaliongame.com/Community_Servers#Firewalls_.2F_Port_Forwarding
  602. if [ "${port}" -eq "${port}" ]; then
  603. echo -e "> Steam\tINBOUND\t$((port+1))\tudp"
  604. echo -e "> Unused\tINBOUND\t$((port+2))\ttcp"
  605. fi
  606. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  607. } | column -s $'\t' -t
  608. }
  609. fn_info_message_cod(){
  610. echo -e "netstat -atunp | grep cod_lnxded"
  611. echo -e ""
  612. {
  613. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  614. echo -e "> Game\tINBOUND\t${port}\tudp"
  615. } | column -s $'\t' -t
  616. }
  617. fn_info_message_coduo(){
  618. echo -e "netstat -atunp | grep coduo_lnxded"
  619. echo -e ""
  620. {
  621. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  622. echo -e "> Game\tINBOUND\t${port}\tudp"
  623. } | column -s $'\t' -t
  624. }
  625. fn_info_message_cod2(){
  626. echo -e "netstat -atunp | grep cod2_lnxded"
  627. echo -e ""
  628. {
  629. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  630. echo -e "> Game\tINBOUND\t${port}\tudp"
  631. } | column -s $'\t' -t
  632. }
  633. fn_info_message_cod4(){
  634. echo -e "netstat -atunp"
  635. echo -e ""
  636. {
  637. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  638. echo -e "> Game\tINBOUND\t${port}\tudp"
  639. } | column -s $'\t' -t
  640. }
  641. fn_info_message_codwaw(){
  642. echo -e "netstat -atunp | grep codwaw_lnxded"
  643. echo -e ""
  644. {
  645. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  646. echo -e "> Game\tINBOUND\t${port}\tudp"
  647. } | column -s $'\t' -t
  648. }
  649. fn_info_message_dst(){
  650. echo -e "netstat -atunp | grep dontstarve"
  651. echo -e ""
  652. {
  653. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  654. echo -e "> Game: Server\tINBOUND\t${port}\tudp"
  655. echo -e "> Game: Master\tINBOUND\t${masterport}\tudp"
  656. echo -e "> Steam: Auth\tINBOUND\t${steamauthenticationport}\tudp"
  657. echo -e "> Steam: Master\tINBOUND\t${steammasterserverport}\tudp"
  658. } | column -s $'\t' -t
  659. }
  660. fn_info_message_eco(){
  661. echo -e "netstat -atunp | grep mono"
  662. echo -e ""
  663. {
  664. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  665. echo -e "> Game\tINBOUND\t${port}\tudp"
  666. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
  667. } | column -s $'\t' -t
  668. }
  669. fn_info_message_etlegacy(){
  670. echo -e "netstat -atunp | grep etlded"
  671. echo -e ""
  672. {
  673. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  674. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  675. } | column -s $'\t' -t
  676. }
  677. fn_info_message_factorio(){
  678. echo -e "netstat -atunp | grep factorio"
  679. echo -e ""
  680. {
  681. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  682. echo -e "> Game\tINBOUND\t${port}\tudp"
  683. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  684. } | column -s $'\t' -t
  685. }
  686. fn_info_message_goldsrc(){
  687. echo -e "netstat -atunp | grep hlds_linux"
  688. echo -e ""
  689. {
  690. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  691. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
  692. echo -e "< Client\tOUTBOUND\t${clientport}\tudp"
  693. } | column -s $'\t' -t
  694. }
  695. fn_info_message_hurtworld(){
  696. echo -e "netstat -atunp | grep Hurtworld"
  697. echo -e ""
  698. {
  699. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  700. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  701. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  702. } | column -s $'\t' -t
  703. }
  704. fn_info_message_inss(){
  705. echo -e "netstat -atunp | grep Insurgency"
  706. echo -e ""
  707. {
  708. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  709. echo -e "> Game\tINBOUND\t${port}\tudp"
  710. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  711. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  712. } | column -s $'\t' -t
  713. }
  714. fn_info_message_justcause2(){
  715. echo -e "netstat -atunp | grep Jcmp-Server"
  716. echo -e ""
  717. {
  718. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  719. echo -e "> Game\tINBOUND\t${port}\tudp"
  720. } | column -s $'\t' -t
  721. }
  722. fn_info_message_justcause3(){
  723. echo -e "netstat -atunp | grep Server"
  724. echo -e ""
  725. {
  726. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  727. echo -e "> Game\tINBOUND\t${port}\tudp"
  728. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  729. echo -e "> Steam\tINBOUND\t${steamport}\tudp"
  730. } | column -s $'\t' -t
  731. }
  732. fn_info_message_minecraft(){
  733. echo -e "netstat -atunp | grep java"
  734. echo -e ""
  735. {
  736. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  737. echo -e "> Game\tINBOUND\t${port}\ttcp"
  738. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  739. echo -e "> Rcon\tINBOUND\t${rconport}\ttcp"
  740. } | column -s $'\t' -t
  741. }
  742. fn_info_message_minecraft_bedrock(){
  743. echo -e "netstat -atunp | grep bedrock_serv"
  744. echo -e ""
  745. {
  746. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  747. echo -e "> Game\tINBOUND\t${port}\tudp"
  748. echo -e "> Game\tINBOUND\t${port6}\tudp6"
  749. } | column -s $'\t' -t
  750. }
  751. fn_info_message_onset(){
  752. echo -e "netstat -atunp | grep OnsetServer"
  753. echo -e ""
  754. {
  755. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  756. echo -e "> Game\tINBOUND\t${port}\tudp"
  757. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  758. echo -e "> HTTP\tINBOUND\t${httpport}\ttcp"
  759. } | column -s $'\t' -t
  760. }
  761. fn_info_message_mohaa(){
  762. echo -e "netstat -atunp | grep mohaa_lnxded"
  763. echo -e ""
  764. {
  765. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  766. echo -e "> Game\tINBOUND\t${port}\tudp"
  767. } | column -s $'\t' -t
  768. }
  769. fn_info_message_mumble(){
  770. echo -e "netstat -atunp | grep murmur"
  771. echo -e ""
  772. {
  773. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  774. echo -e "> Voice\tINBOUND\t${port}\tudp"
  775. echo -e "> ServerQuery\tINBOUND\t${port}\ttcp"
  776. } | column -s $'\t' -t
  777. }
  778. fn_info_message_pstbs(){
  779. echo -e "netstat -atunp | grep PostScriptum"
  780. echo -e ""
  781. {
  782. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  783. echo -e "> Game\tINBOUND\t${port}\tudp"
  784. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  785. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  786. } | column -s $'\t' -t
  787. }
  788. fn_info_message_projectcars(){
  789. echo -e "netstat -atunp | grep DedicatedS"
  790. echo -e ""
  791. {
  792. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  793. echo -e "> Game\tINBOUND\t${port}\tudp"
  794. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  795. echo -e "> Steam\tINBOUND\t${steamport}\tudp"
  796. } | column -s $'\t' -t
  797. }
  798. fn_info_message_projectzomboid(){
  799. echo -e "netstat -atunp | grep ProjectZomb"
  800. echo -e ""
  801. {
  802. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  803. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  804. } | column -s $'\t' -t
  805. }
  806. fn_info_message_quake(){
  807. echo -e "netstat -atunp | grep mvdsv"
  808. echo -e ""
  809. {
  810. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  811. echo -e "> Game\tINBOUND\t${port}\tudp"
  812. } | column -s $'\t' -t
  813. }
  814. fn_info_message_quake2(){
  815. echo -e "netstat -atunp | grep quake2"
  816. echo -e ""
  817. {
  818. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  819. echo -e "> Game\tINBOUND\t${port}\tudp"
  820. } | column -s $'\t' -t
  821. }
  822. fn_info_message_quake3(){
  823. echo -e "netstat -atunp | grep q3ded"
  824. echo -e ""
  825. {
  826. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  827. echo -e "> Game\tINBOUND\t${port}\tudp"
  828. } | column -s $'\t' -t
  829. }
  830. fn_info_message_quakelive(){
  831. echo -e "netstat -atunp | grep qzeroded"
  832. echo -e ""
  833. if [ -z "${port}" ]||[ -z "${rconport}" ]||[ -z "${statsport}" ]; then
  834. echo -e "${red}ERROR!${default} Missing/commented ports in ${servercfg}."
  835. echo -e ""
  836. fi
  837. {
  838. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  839. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  840. echo -e "> Rcon\tINBOUND\t${rconport}\tudp"
  841. echo -e "> Stats\tINBOUND\t${statsport}\tudp"
  842. } | column -s $'\t' -t
  843. }
  844. fn_info_message_arma3(){
  845. echo -e "netstat -atunp | grep arma3server"
  846. echo -e ""
  847. # Default port
  848. if [ -z "${port}" ]; then
  849. port="2302"
  850. fi
  851. {
  852. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  853. echo -e "> Game\tINBOUND\t${port}\tudp"
  854. # Don't do arithmetics if ever the port wasn't a numeric value
  855. if [ "${port}" -eq "${port}" ]; then
  856. echo -e "> Query Steam\tINBOUND\t$((port+1))\tudp"
  857. echo -e "> Steam: Master traffic\tINBOUND\t$((port+2))\tudp"
  858. echo -e "> Undocumented Port\tINBOUND\t$((port+3))\tudp"
  859. fi
  860. } | column -s $'\t' -t
  861. }
  862. fn_info_message_bf1942(){
  863. echo -e "netstat -atunp | grep bf1942_lnxd"
  864. echo -e ""
  865. {
  866. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  867. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  868. echo -e "> Query Steam\tINBOUND\t${queryport}\tudp"
  869. } | column -s $'\t' -t
  870. }
  871. fn_info_message_risingworld(){
  872. echo -e "netstat -atunp | grep java"
  873. echo -e ""
  874. {
  875. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  876. echo -e "> Game/Query\tINBOUND\t${port}\ttcp/udp"
  877. echo -e "> Query HTTP\tINBOUND\t${httpqueryport}\ttcp"
  878. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  879. } | column -s $'\t' -t
  880. }
  881. fn_info_message_rtcw(){
  882. echo -e "netstat -atunp | grep iowolfded"
  883. echo -e ""
  884. {
  885. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  886. echo -e "> Game\tINBOUND\t${port}\tudp"
  887. } | column -s $'\t' -t
  888. }
  889. fn_info_message_rust(){
  890. echo -e "netstat -atunp | grep Rust"
  891. echo -e ""
  892. {
  893. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  894. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  895. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  896. } | column -s $'\t' -t
  897. }
  898. fn_info_message_samp(){
  899. echo -e "netstat -atunp | grep samp03svr"
  900. echo -e ""
  901. {
  902. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  903. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
  904. } | column -s $'\t' -t
  905. }
  906. fn_info_message_ss3(){
  907. echo -e "netstat -atunp | grep Sam3_Ded"
  908. echo -e ""
  909. {
  910. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  911. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp"
  912. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  913. } | column -s $'\t' -t
  914. }
  915. fn_info_message_sbots(){
  916. echo -e "netstat -atunp | grep blank1"
  917. echo -e ""
  918. {
  919. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  920. echo -e "> Game\tINBOUND\t${port}\tudp"
  921. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  922. } | column -s $'\t' -t
  923. }
  924. fn_info_message_sdtd(){
  925. fn_info_message_password_strip
  926. echo -e "netstat -atunp | grep 7DaysToDie"
  927. echo -e ""
  928. {
  929. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  930. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  931. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  932. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
  933. echo -e "> Telnet\tINBOUND\t${telnetport}\ttcp"
  934. } | column -s $'\t' -t
  935. echo -e ""
  936. echo -e "${lightgreen}${servername} WebAdmin${default}"
  937. fn_messages_separator
  938. {
  939. echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}"
  940. echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
  941. echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}"
  942. } | column -s $'\t' -t
  943. echo -e ""
  944. echo -e "${lightgreen}${servername} Telnet${default}"
  945. fn_messages_separator
  946. {
  947. echo -e "${lightblue}Telnet enabled:\t${default}${telnetenabled}"
  948. echo -e "${lightblue}Telnet address:\t${default}${ip} ${telnetport}"
  949. echo -e "${lightblue}Telnet password:\t${default}${telnetpass}"
  950. } | column -s $'\t' -t
  951. }
  952. fn_info_message_sof2(){
  953. echo -e "netstat -atunp | grep sof2ded"
  954. echo -e ""
  955. {
  956. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  957. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  958. } | column -s $'\t' -t
  959. }
  960. fn_info_message_source(){
  961. echo -e "netstat -atunp | grep srcds_linux"
  962. echo -e ""
  963. {
  964. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  965. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
  966. echo -e "> SourceTV\tINBOUND\t${sourcetvport}\tudp"
  967. echo -e "< Client\tOUTBOUND\t${clientport}\tudp"
  968. } | column -s $'\t' -t
  969. }
  970. fn_info_message_spark(){
  971. fn_info_message_password_strip
  972. echo -e "netstat -atunp | grep server_linux"
  973. echo -e ""
  974. {
  975. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  976. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  977. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  978. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
  979. } | column -s $'\t' -t
  980. echo -e ""
  981. echo -e "${lightgreen}${servername} WebAdmin${default}"
  982. fn_messages_separator
  983. {
  984. echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}/index.html"
  985. echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}"
  986. echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}"
  987. } | column -s $'\t' -t
  988. }
  989. fn_info_message_squad(){
  990. echo -e "netstat -atunp | grep SquadServer"
  991. echo -e ""
  992. {
  993. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  994. echo -e "> Game\tINBOUND\t${port}\tudp"
  995. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  996. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  997. } | column -s $'\t' -t
  998. }
  999. fn_info_message_starbound(){
  1000. echo -e "netstat -atunp | grep starbound"
  1001. echo -e ""
  1002. {
  1003. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1004. echo -e "> Game\tINBOUND\t${port}\ttcp"
  1005. echo -e "> Query\tINBOUND\t${queryport}\ttcp"
  1006. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  1007. } | column -s $'\t' -t
  1008. }
  1009. fn_info_message_stationeers(){
  1010. echo -e "netstat -atunp | grep rocketstation"
  1011. echo -e ""
  1012. {
  1013. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1014. echo -e "> Game\tINBOUND\t${port}\ttcp"
  1015. echo -e "> Query\tINBOUND\t${queryport}\ttcp"
  1016. } | column -s $'\t' -t
  1017. }
  1018. fn_info_message_teamspeak3(){
  1019. echo -e "netstat -atunp | grep ts3server"
  1020. echo -e ""
  1021. {
  1022. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1023. echo -e "> Voice\tINBOUND\t${port}\tudp"
  1024. echo -e "> ServerQuery\tINBOUND\t${queryport}\ttcp"
  1025. echo -e "> File transfer\tINBOUND\t${fileport}\ttcp"
  1026. } | column -s $'\t' -t
  1027. }
  1028. fn_info_message_teeworlds(){
  1029. echo -e "netstat -atunp | grep teeworlds"
  1030. echo -e ""
  1031. {
  1032. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1033. echo -e "> Game\Query\tINBOUND\t${port}\ttcp"
  1034. } | column -s $'\t' -t
  1035. }
  1036. fn_info_message_terraria(){
  1037. echo -e "netstat -atunp | grep Terraria"
  1038. echo -e ""
  1039. {
  1040. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1041. echo -e "> Game\tINBOUND\t${port}\ttcp"
  1042. } | column -s $'\t' -t
  1043. }
  1044. fn_info_message_towerunite(){
  1045. echo -e "netstat -atunp | grep TowerServer"
  1046. echo -e ""
  1047. {
  1048. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1049. echo -e "> Game\tINBOUND\t${port}\ttcp"
  1050. # Don't do arithmetics if ever the port wasn't a numeric value
  1051. if [ "${port}" -eq "${port}" ]; then
  1052. echo -e "> Steam\tINBOUND\t$((port+1))\tudp"
  1053. fi
  1054. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1055. } | column -s $'\t' -t
  1056. }
  1057. fn_info_message_unreal(){
  1058. fn_info_message_password_strip
  1059. echo -e "netstat -atunp | grep ucc-bin"
  1060. echo -e ""
  1061. {
  1062. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL\tINI VARIABLE"
  1063. echo -e "> Game\tINBOUND\t${port}\tudp\tPort=${port}"
  1064. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1065. if [ "${engine}" == "unreal" ]; then
  1066. echo -e "< UdpLink Port (random)\tOUTBOUND\t${udplinkport}+\tudp"
  1067. fi
  1068. if [ "${engine}" != "unreal" ]&&[ "${appid}" != "223250" ]; then
  1069. echo -e "> Query (GameSpy)\tINBOUND\t${queryportgs}\tudp\tOldQueryPortNumber=${queryportgs}"
  1070. fi
  1071. if [ "${appid}" == "215360" ]; then
  1072. echo -e "< Master server\tOUTBOUND\t28852\ttcp/udp"
  1073. else
  1074. echo -e "< Master server\tOUTBOUND\t28900/28902\ttcp/udp"
  1075. fi
  1076. if [ "${appid}" ]; then
  1077. if [ "${appid}" == "223250" ]; then
  1078. echo -e "< Steam\tINBOUND\t20610\tudp"
  1079. else
  1080. echo -e "< Steam\tINBOUND\t20660\tudp"
  1081. fi
  1082. fi
  1083. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp\tListenPort=${webadminport}"
  1084. } | column -s $'\t' -t
  1085. echo -e ""
  1086. echo -e "${lightgreen}${servername} WebAdmin${default}"
  1087. fn_messages_separator
  1088. {
  1089. echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}"
  1090. echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
  1091. echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}"
  1092. echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}"
  1093. } | column -s $'\t' -t
  1094. }
  1095. fn_info_message_unreal2(){
  1096. fn_info_message_password_strip
  1097. echo -e "netstat -atunp | grep ucc-bin"
  1098. echo -e ""
  1099. {
  1100. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL\tINI VARIABLE"
  1101. echo -e "> Game\tINBOUND\t${port}\tudp\tPort=${port}"
  1102. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1103. if [ "${appid}" != "223250" ]; then
  1104. echo -e "> Query (GameSpy)\tINBOUND\t${queryportgs}\tudp\tOldQueryPortNumber=${queryportgs}"
  1105. fi
  1106. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp\tListenPort=${webadminport}"
  1107. } | column -s $'\t' -t
  1108. echo -e ""
  1109. echo -e "${lightgreen}${servername} WebAdmin${default}"
  1110. fn_messages_separator
  1111. {
  1112. echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}"
  1113. echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
  1114. echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}"
  1115. echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}"
  1116. } | column -s $'\t' -t
  1117. }
  1118. fn_info_message_unreal3(){
  1119. fn_info_message_password_strip
  1120. echo -e "netstat -atunp | grep ut3-bin"
  1121. echo -e ""
  1122. {
  1123. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1124. echo -e "> Game\tINBOUND\t${port}\tudp"
  1125. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1126. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp\tListenPort=${webadminport}"
  1127. } | column -s $'\t' -t
  1128. echo -e ""
  1129. echo -e "${lightgreen}${servername} WebAdmin${default}"
  1130. fn_messages_separator
  1131. {
  1132. echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}"
  1133. echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
  1134. echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}"
  1135. echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}"
  1136. } | column -s $'\t' -t
  1137. }
  1138. fn_info_message_unturned(){
  1139. echo -e "netstat -atunp | grep Unturned"
  1140. echo -e ""
  1141. {
  1142. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1143. echo -e "> Game\tINBOUND\t${port}\tudp"
  1144. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1145. } | column -s $'\t' -t
  1146. }
  1147. fn_info_message_ut(){
  1148. echo -e "netstat -atunp | grep UE4Server"
  1149. echo -e ""
  1150. {
  1151. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1152. echo -e "> Game\tINBOUND\t${port}\tudp"
  1153. } | column -s $'\t' -t
  1154. }
  1155. fn_info_message_kf2(){
  1156. fn_info_message_password_strip
  1157. echo -e "netstat -atunp | grep KFGame"
  1158. echo -e ""
  1159. {
  1160. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1161. echo -e "> Game\tINBOUND\t${port}\ttcp\tPort=${port}"
  1162. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1163. echo -e "> Steam\tINBOUND\t20560\tudp"
  1164. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp\tListenPort=${webadminport}"
  1165. } | column -s $'\t' -t
  1166. echo -e ""
  1167. echo -e "${lightgreen}${servername} WebAdmin${default}"
  1168. fn_messages_separator
  1169. {
  1170. echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}"
  1171. echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
  1172. echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}"
  1173. echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}"
  1174. } | column -s $'\t' -t
  1175. }
  1176. fn_info_message_wolfensteinenemyterritory(){
  1177. echo -e "netstat -atunp | grep etded"
  1178. echo -e ""
  1179. {
  1180. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1181. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  1182. } | column -s $'\t' -t
  1183. }
  1184. fn_info_message_wurmunlimited(){
  1185. echo -e "netstat -atunp | grep WurmServer"
  1186. echo -e ""
  1187. {
  1188. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1189. echo -e "> Game\tINBOUND\t${port}\ttcp"
  1190. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1191. } | column -s $'\t' -t
  1192. }
  1193. fn_info_message_mta(){
  1194. echo -e "netstat -atunp | grep mta-server"
  1195. echo -e ""
  1196. {
  1197. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1198. echo -e "> Game/Query\tOUTBOUND\t${port}\tudp"
  1199. echo -e "> HTTP Server\tINBOUND\t${httpport}\ttcp"
  1200. if [ "${ase}" == "Enabled" ]; then
  1201. echo -e "> Query Port\tOUTBOUND\t${queryport}\tudp"
  1202. fi
  1203. } | column -s $'\t' -t
  1204. }
  1205. fn_info_message_mordhau(){
  1206. echo -e "netstat -atunp | grep Mord"
  1207. echo -e ""
  1208. {
  1209. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1210. echo -e "> Game\tINBOUND\t${port}\tudp"
  1211. echo -e "> BeaconPort\tINBOUND\t${beaconport}\tudp"
  1212. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1213. } | column -s $'\t' -t
  1214. }
  1215. fn_info_message_barotrauma(){
  1216. echo -e "netstat -atunp | grep /./Server.bin"
  1217. echo -e ""
  1218. {
  1219. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1220. echo -e "> Game\tINBOUND\t${port}\tudp"
  1221. echo -e "> Query\tINBOUND\t$((port+1))\tudp"
  1222. } | column -s $'\t' -t
  1223. }
  1224. fn_info_message_soldat() {
  1225. echo -e "netstat -atunp | grep soldat"
  1226. echo -e ""
  1227. {
  1228. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1229. echo -e "> Game\tINBOUND\t${port}\tudp"
  1230. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1231. echo -e "> FILES\tINBOUND\t$((port+10))\ttcp"
  1232. } | column -s $'\t' -t
  1233. }
  1234. fn_info_message_warfork(){
  1235. echo -e "netstat -atunp | grep wf_server"
  1236. echo -e ""
  1237. {
  1238. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1239. echo -e "> Game\tINBOUND\t${port}\tudp"
  1240. echo -e "> HTTP\tINBOUND\t${httpport}\ttcp"
  1241. } | column -s $'\t' -t
  1242. }
  1243. fn_info_message_select_engine(){
  1244. # Display details depending on game or engine.
  1245. if [ "${shortname}" == "ac" ]; then
  1246. fn_info_message_assettocorsa
  1247. elif [ "${shortname}" == "ark" ]; then
  1248. fn_info_message_ark
  1249. elif [ "${shortname}" == "av" ]; then
  1250. fn_info_message_avorion
  1251. elif [ "${shortname}" == "arma3" ]; then
  1252. fn_info_message_arma3
  1253. elif [ "${shortname}" == "bo" ]; then
  1254. fn_info_message_ballisticoverkill
  1255. elif [ "${shortname}" == "bt" ]; then
  1256. fn_info_message_barotrauma
  1257. elif [ "${shortname}" == "bt1944" ]; then
  1258. fn_info_message_battalion1944
  1259. elif [ "${shortname}" == "cod" ]; then
  1260. fn_info_message_cod
  1261. elif [ "${shortname}" == "coduo" ]; then
  1262. fn_info_message_coduo
  1263. elif [ "${shortname}" == "cod2" ]; then
  1264. fn_info_message_cod2
  1265. elif [ "${shortname}" == "cod4" ]; then
  1266. fn_info_message_cod4
  1267. elif [ "${shortname}" == "codwaw" ]; then
  1268. fn_info_message_codwaw
  1269. elif [ "${shortname}" == "dst" ]; then
  1270. fn_info_message_dst
  1271. elif [ "${shortname}" == "eco" ]; then
  1272. fn_info_message_eco
  1273. elif [ "${shortname}" == "etl" ]; then
  1274. fn_info_message_etlegacy
  1275. elif [ "${shortname}" == "fctr" ]; then
  1276. fn_info_message_factorio
  1277. elif [ "${shortname}" == "hw" ]; then
  1278. fn_info_message_hurtworld
  1279. elif [ "${shortname}" == "inss" ]; then
  1280. fn_info_message_inss
  1281. elif [ "${shortname}" == "jc2" ]; then
  1282. fn_info_message_justcause2
  1283. elif [ "${shortname}" == "jc3" ]; then
  1284. fn_info_message_justcause3
  1285. elif [ "${shortname}" == "kf2" ]; then
  1286. fn_info_message_kf2
  1287. elif [ "${shortname}" == "mcb" ]; then
  1288. fn_info_message_minecraft_bedrock
  1289. elif [ "${shortname}" == "onset" ]; then
  1290. fn_info_message_onset
  1291. elif [ "${shortname}" == "pz" ]; then
  1292. fn_info_message_projectzomboid
  1293. elif [ "${shortname}" == "pstbs" ]; then
  1294. fn_info_message_pstbs
  1295. elif [ "${shortname}" == "pc" ]; then
  1296. fn_info_message_projectcars
  1297. elif [ "${shortname}" == "qw" ]; then
  1298. fn_info_message_quake
  1299. elif [ "${shortname}" == "q2" ]; then
  1300. fn_info_message_quake2
  1301. elif [ "${shortname}" == "q3" ]; then
  1302. fn_info_message_quake3
  1303. elif [ "${shortname}" == "ql" ]; then
  1304. fn_info_message_quakelive
  1305. elif [ "${shortname}" == "samp" ]; then
  1306. fn_info_message_samp
  1307. elif [ "${shortname}" == "sdtd" ]; then
  1308. fn_info_message_sdtd
  1309. elif [ "${shortname}" == "squad" ]; then
  1310. fn_info_message_squad
  1311. elif [ "${shortname}" == "st" ]; then
  1312. fn_info_message_stationeers
  1313. elif [ "${shortname}" == "sof2" ]; then
  1314. fn_info_message_sof2
  1315. elif [ "${shortname}" == "sol" ]; then
  1316. fn_info_message_soldat
  1317. elif [ "${shortname}" == "st" ]; then
  1318. fn_info_message_starbound
  1319. elif [ "${shortname}" == "sbots" ]; then
  1320. fn_info_message_sbots
  1321. elif [ "${shortname}" == "ss3" ]; then
  1322. fn_info_message_ss3
  1323. elif [ "${shortname}" == "terraria" ]; then
  1324. fn_info_message_terraria
  1325. elif [ "${shortname}" == "ts3" ]; then
  1326. fn_info_message_teamspeak3
  1327. elif [ "${shortname}" == "tu" ]; then
  1328. fn_info_message_towerunite
  1329. elif [ "${shortname}" == "tw" ]; then
  1330. fn_info_message_teeworlds
  1331. elif [ "${shortname}" == "unt" ]; then
  1332. fn_info_message_unturned
  1333. elif [ "${shortname}" == "ut" ]; then
  1334. fn_info_message_ut
  1335. elif [ "${shortname}" == "mc" ]; then
  1336. fn_info_message_minecraft
  1337. elif [ "${shortname}" == "mh" ]; then
  1338. fn_info_message_mordhau
  1339. elif [ "${shortname}" == "mohaa" ]; then
  1340. fn_info_message_mohaa
  1341. elif [ "${shortname}" == "mta" ]; then
  1342. fn_info_message_mta
  1343. elif [ "${shortname}" == "mumble" ]; then
  1344. fn_info_message_mumble
  1345. elif [ "${engine}" == "bf1942" ]; then
  1346. fn_info_message_bf1942
  1347. elif [ "${shortname}" == "rtcw" ]; then
  1348. fn_info_message_rtcw
  1349. elif [ "${shortname}" == "rust" ]; then
  1350. fn_info_message_rust
  1351. elif [ "${shortname}" == "wf" ]; then
  1352. fn_info_message_warfork
  1353. elif [ "${shortname}" == "wurm" ]; then
  1354. fn_info_message_wurmunlimited
  1355. elif [ "${shortname}" == "rw" ]; then
  1356. fn_info_message_risingworld
  1357. elif [ "${shortname}" == "wet" ]; then
  1358. fn_info_message_wolfensteinenemyterritory
  1359. elif [ "${engine}" == "goldsrc" ]; then
  1360. fn_info_message_goldsrc
  1361. elif [ "${engine}" == "source" ]; then
  1362. fn_info_message_source
  1363. elif [ "${engine}" == "spark" ]; then
  1364. fn_info_message_spark
  1365. elif [ "${engine}" == "unreal" ]; then
  1366. fn_info_message_unreal
  1367. elif [ "${engine}" == "unreal2" ]; then
  1368. fn_info_message_unreal2
  1369. elif [ "${engine}" == "unreal3" ]; then
  1370. fn_info_message_unreal3
  1371. else
  1372. fn_print_error_nl "Unable to detect server engine."
  1373. fi
  1374. }
  1375. # Separator is different for details
  1376. fn_messages_separator(){
  1377. if [ "${commandname}" == "details" ]; then
  1378. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  1379. else
  1380. echo -e "================================="
  1381. fi
  1382. }
  1383. # Removes the passwords form all but details
  1384. fn_info_message_password_strip(){
  1385. if [ "${commandname}" != "DETAILS" ]; then
  1386. if [ "${serverpassword}" ]; then
  1387. serverpassword="********"
  1388. fi
  1389. if [ "${rconpassword}" ]; then
  1390. rconpassword="********"
  1391. fi
  1392. if [ "${adminpassword}" ]; then
  1393. adminpassword="********"
  1394. fi
  1395. if [ "${statspassword}" ]; then
  1396. statspassword="********"
  1397. fi
  1398. if [ "${webadminpass}" ]; then
  1399. webadminpass="********"
  1400. fi
  1401. if [ "${telnetpass}" ]; then
  1402. telnetpass="********"
  1403. fi
  1404. if [ "${wsapikey}" ]; then
  1405. wsapikey="********"
  1406. fi
  1407. if [ "${gslt}" ]; then
  1408. gslt="********"
  1409. fi
  1410. fi
  1411. }