info_messages.sh 45 KB

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