info_messages.sh 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553
  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 [ -n "${netint}" ]; then
  103. echo -e "${lightblue}Interface:\t${default}${netint}"
  104. fi
  105. if [ -n "${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}${rconenabled}"
  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=( "Avorion" "goldsrc" "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_assettocorsa(){
  553. echo -e "netstat -atunp| grep acServer"
  554. echo -e ""
  555. {
  556. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  557. echo -e "> Game\tINBOUND\t${port}\tudp"
  558. echo -e "> HTTP\tINBOUND\t${port}\tudp"
  559. } | column -s $'\t' -t
  560. }
  561. fn_info_message_ark(){
  562. echo -e "netstat -atunp | grep ShooterGame"
  563. echo -e ""
  564. {
  565. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  566. echo -e "> Game\tINBOUND\t${port}\tudp"
  567. # Don't do arithmetics if ever the port wasn't a numeric value
  568. if [ "${port}" -eq "${port}" ]; then
  569. echo -e "> RAW\tINBOUND\t$((port+1))\tudp"
  570. fi
  571. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  572. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  573. } | column -s $'\t' -t
  574. }
  575. fn_info_message_avorion() {
  576. echo "netstat -atunp | grep Avorion"
  577. echo -e ""
  578. {
  579. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  580. echo -e "> Game\tINBOUND\t${port}\tudp"
  581. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  582. } | column -s $'\t' -t
  583. }
  584. fn_info_message_ballisticoverkill(){
  585. echo -e "netstat -atunp | grep BODS.x86"
  586. echo -e ""
  587. {
  588. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  589. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  590. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  591. } | column -s $'\t' -t
  592. }
  593. fn_info_message_battalion1944(){
  594. echo -e "netstat -atunp | grep BattalionServ"
  595. echo -e ""
  596. {
  597. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  598. echo -e "> Game\tINBOUND\t${port}\tudp"
  599. # Don't do arithmetics if ever the port wasn't a numeric value
  600. # unconfirmed - http://wiki.battaliongame.com/Community_Servers#Firewalls_.2F_Port_Forwarding
  601. if [ "${port}" -eq "${port}" ]; then
  602. echo -e "> Steam\tINBOUND\t$((port+1))\tudp"
  603. echo -e "> Unused\tINBOUND\t$((port+2))\ttcp"
  604. fi
  605. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  606. } | column -s $'\t' -t
  607. }
  608. fn_info_message_cod(){
  609. echo -e "netstat -atunp | grep cod_lnxded"
  610. echo -e ""
  611. {
  612. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  613. echo -e "> Game\tINBOUND\t${port}\tudp"
  614. } | column -s $'\t' -t
  615. }
  616. fn_info_message_coduo(){
  617. echo -e "netstat -atunp | grep coduo_lnxded"
  618. echo -e ""
  619. {
  620. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  621. echo -e "> Game\tINBOUND\t${port}\tudp"
  622. } | column -s $'\t' -t
  623. }
  624. fn_info_message_cod2(){
  625. echo -e "netstat -atunp | grep cod2_lnxded"
  626. echo -e ""
  627. {
  628. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  629. echo -e "> Game\tINBOUND\t${port}\tudp"
  630. } | column -s $'\t' -t
  631. }
  632. fn_info_message_cod4(){
  633. echo -e "netstat -atunp"
  634. echo -e ""
  635. {
  636. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  637. echo -e "> Game\tINBOUND\t${port}\tudp"
  638. } | column -s $'\t' -t
  639. }
  640. fn_info_message_codwaw(){
  641. echo -e "netstat -atunp | grep codwaw_lnxded"
  642. echo -e ""
  643. {
  644. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  645. echo -e "> Game\tINBOUND\t${port}\tudp"
  646. } | column -s $'\t' -t
  647. }
  648. fn_info_message_dst(){
  649. echo -e "netstat -atunp | grep dontstarve"
  650. echo -e ""
  651. {
  652. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  653. echo -e "> Game: Server\tINBOUND\t${port}\tudp"
  654. echo -e "> Game: Master\tINBOUND\t${masterport}\tudp"
  655. echo -e "> Steam: Auth\tINBOUND\t${steamauthenticationport}\tudp"
  656. echo -e "> Steam: Master\tINBOUND\t${steammasterserverport}\tudp"
  657. } | column -s $'\t' -t
  658. }
  659. fn_info_message_eco(){
  660. echo -e "netstat -atunp | grep mono"
  661. echo -e ""
  662. {
  663. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  664. echo -e "> Game\tINBOUND\t${port}\tudp"
  665. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
  666. } | column -s $'\t' -t
  667. }
  668. fn_info_message_etlegacy(){
  669. echo -e "netstat -atunp | grep etlded"
  670. echo -e ""
  671. {
  672. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  673. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  674. } | column -s $'\t' -t
  675. }
  676. fn_info_message_factorio(){
  677. echo -e "netstat -atunp | grep factorio"
  678. echo -e ""
  679. {
  680. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  681. echo -e "> Game\tINBOUND\t${port}\tudp"
  682. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  683. } | column -s $'\t' -t
  684. }
  685. fn_info_message_goldsrc(){
  686. echo -e "netstat -atunp | grep hlds_linux"
  687. echo -e ""
  688. {
  689. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  690. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
  691. echo -e "< Client\tOUTBOUND\t${clientport}\tudp"
  692. } | column -s $'\t' -t
  693. }
  694. fn_info_message_hurtworld(){
  695. echo -e "netstat -atunp | grep Hurtworld"
  696. echo -e ""
  697. {
  698. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  699. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  700. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  701. } | column -s $'\t' -t
  702. }
  703. fn_info_message_inss(){
  704. echo -e "netstat -atunp | grep Insurgency"
  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 "> RCON\tINBOUND\t${rconport}\ttcp"
  711. } | column -s $'\t' -t
  712. }
  713. fn_info_message_justcause2(){
  714. echo -e "netstat -atunp | grep Jcmp-Server"
  715. echo -e ""
  716. {
  717. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  718. echo -e "> Game\tINBOUND\t${port}\tudp"
  719. } | column -s $'\t' -t
  720. }
  721. fn_info_message_justcause3(){
  722. echo -e "netstat -atunp | grep Server"
  723. echo -e ""
  724. {
  725. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  726. echo -e "> Game\tINBOUND\t${port}\tudp"
  727. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  728. echo -e "> Steam\tINBOUND\t${steamport}\tudp"
  729. } | column -s $'\t' -t
  730. }
  731. fn_info_message_minecraft(){
  732. echo -e "netstat -atunp | grep java"
  733. echo -e ""
  734. {
  735. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  736. echo -e "> Game\tINBOUND\t${port}\ttcp"
  737. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  738. echo -e "> Rcon\tINBOUND\t${rconport}\ttcp"
  739. } | column -s $'\t' -t
  740. }
  741. fn_info_message_minecraft_bedrock(){
  742. echo -e "netstat -atunp | grep bedrock_serv"
  743. echo -e ""
  744. {
  745. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  746. echo -e "> Game\tINBOUND\t${port}\tudp"
  747. echo -e "> Game\tINBOUND\t${port6}\tudp6"
  748. } | column -s $'\t' -t
  749. }
  750. fn_info_message_onset(){
  751. echo -e "netstat -atunp | grep OnsetServer"
  752. echo -e ""
  753. {
  754. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  755. echo -e "> Game\tINBOUND\t${port}\tudp"
  756. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  757. echo -e "> HTTP\tINBOUND\t${httpport}\ttcp"
  758. } | column -s $'\t' -t
  759. }
  760. fn_info_message_mohaa(){
  761. echo -e "netstat -atunp | grep mohaa_lnxded"
  762. echo -e ""
  763. {
  764. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  765. echo -e "> Game\tINBOUND\t${port}\tudp"
  766. } | column -s $'\t' -t
  767. }
  768. fn_info_message_mumble(){
  769. echo -e "netstat -atunp | grep murmur"
  770. echo -e ""
  771. {
  772. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  773. echo -e "> Voice\tINBOUND\t${port}\tudp"
  774. echo -e "> ServerQuery\tINBOUND\t${port}\ttcp"
  775. } | column -s $'\t' -t
  776. }
  777. fn_info_message_pstbs(){
  778. echo -e "netstat -atunp | grep PostScriptum"
  779. echo -e ""
  780. {
  781. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  782. echo -e "> Game\tINBOUND\t${port}\tudp"
  783. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  784. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  785. } | column -s $'\t' -t
  786. }
  787. fn_info_message_projectcars(){
  788. echo -e "netstat -atunp | grep DedicatedS"
  789. echo -e ""
  790. {
  791. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  792. echo -e "> Game\tINBOUND\t${port}\tudp"
  793. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  794. echo -e "> Steam\tINBOUND\t${steamport}\tudp"
  795. } | column -s $'\t' -t
  796. }
  797. fn_info_message_projectzomboid(){
  798. echo -e "netstat -atunp | grep ProjectZomb"
  799. echo -e ""
  800. {
  801. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  802. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  803. } | column -s $'\t' -t
  804. }
  805. fn_info_message_quake(){
  806. echo -e "netstat -atunp | grep mvdsv"
  807. echo -e ""
  808. {
  809. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  810. echo -e "> Game\tINBOUND\t${port}\tudp"
  811. } | column -s $'\t' -t
  812. }
  813. fn_info_message_quake2(){
  814. echo -e "netstat -atunp | grep quake2"
  815. echo -e ""
  816. {
  817. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  818. echo -e "> Game\tINBOUND\t${port}\tudp"
  819. } | column -s $'\t' -t
  820. }
  821. fn_info_message_quake3(){
  822. echo -e "netstat -atunp | grep q3ded"
  823. echo -e ""
  824. {
  825. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  826. echo -e "> Game\tINBOUND\t${port}\tudp"
  827. } | column -s $'\t' -t
  828. }
  829. fn_info_message_quakelive(){
  830. echo -e "netstat -atunp | grep qzeroded"
  831. echo -e ""
  832. if [ -z "${port}" ]||[ -z "${rconport}" ]||[ -z "${statsport}" ]; then
  833. echo -e "${red}ERROR!${default} Missing/commented ports in ${servercfg}."
  834. echo -e ""
  835. fi
  836. {
  837. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  838. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  839. echo -e "> Rcon\tINBOUND\t${rconport}\tudp"
  840. echo -e "> Stats\tINBOUND\t${statsport}\tudp"
  841. } | column -s $'\t' -t
  842. }
  843. fn_info_message_arma3(){
  844. echo -e "netstat -atunp | grep arma3server"
  845. echo -e ""
  846. # Default port
  847. if [ -z "${port}" ]; then
  848. port="2302"
  849. fi
  850. {
  851. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  852. echo -e "> Game\tINBOUND\t${port}\tudp"
  853. # Don't do arithmetics if ever the port wasn't a numeric value
  854. if [ "${port}" -eq "${port}" ]; then
  855. echo -e "> Query Steam\tINBOUND\t$((port+1))\tudp"
  856. echo -e "> Steam: Master traffic\tINBOUND\t$((port+2))\tudp"
  857. echo -e "> Undocumented Port\tINBOUND\t$((port+3))\tudp"
  858. fi
  859. } | column -s $'\t' -t
  860. }
  861. fn_info_message_bf1942(){
  862. echo -e "netstat -atunp | grep bf1942_lnxd"
  863. echo -e ""
  864. {
  865. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  866. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  867. echo -e "> Query Steam\tINBOUND\t${queryport}\tudp"
  868. } | column -s $'\t' -t
  869. }
  870. fn_info_message_risingworld(){
  871. echo -e "netstat -atunp | grep java"
  872. echo -e ""
  873. {
  874. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  875. echo -e "> Game/Query\tINBOUND\t${port}\ttcp/udp"
  876. echo -e "> Query HTTP\tINBOUND\t${httpqueryport}\ttcp"
  877. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  878. } | column -s $'\t' -t
  879. }
  880. fn_info_message_rtcw(){
  881. echo -e "netstat -atunp | grep iowolfded"
  882. echo -e ""
  883. {
  884. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  885. echo -e "> Game\tINBOUND\t${port}\tudp"
  886. } | column -s $'\t' -t
  887. }
  888. fn_info_message_rust(){
  889. echo -e "netstat -atunp | grep Rust"
  890. echo -e ""
  891. {
  892. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  893. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  894. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  895. } | column -s $'\t' -t
  896. }
  897. fn_info_message_samp(){
  898. echo -e "netstat -atunp | grep samp03svr"
  899. echo -e ""
  900. {
  901. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  902. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
  903. } | column -s $'\t' -t
  904. }
  905. fn_info_message_ss3(){
  906. echo -e "netstat -atunp | grep Sam3_Ded"
  907. echo -e ""
  908. {
  909. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  910. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp"
  911. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  912. } | column -s $'\t' -t
  913. }
  914. fn_info_message_sbots(){
  915. echo -e "netstat -atunp | grep blank1"
  916. echo -e ""
  917. {
  918. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  919. echo -e "> Game\tINBOUND\t${port}\tudp"
  920. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  921. } | column -s $'\t' -t
  922. }
  923. fn_info_message_sdtd(){
  924. fn_info_message_password_strip
  925. echo -e "netstat -atunp | grep 7DaysToDie"
  926. echo -e ""
  927. {
  928. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  929. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  930. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  931. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
  932. echo -e "> Telnet\tINBOUND\t${telnetport}\ttcp"
  933. } | column -s $'\t' -t
  934. echo -e ""
  935. echo -e "${lightgreen}${servername} WebAdmin${default}"
  936. fn_messages_separator
  937. {
  938. echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}"
  939. echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
  940. echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}"
  941. } | column -s $'\t' -t
  942. echo -e ""
  943. echo -e "${lightgreen}${servername} Telnet${default}"
  944. fn_messages_separator
  945. {
  946. echo -e "${lightblue}Telnet enabled:\t${default}${telnetenabled}"
  947. echo -e "${lightblue}Telnet address:\t${default}${ip} ${telnetport}"
  948. echo -e "${lightblue}Telnet password:\t${default}${telnetpass}"
  949. } | column -s $'\t' -t
  950. }
  951. fn_info_message_sof2(){
  952. echo -e "netstat -atunp | grep sof2ded"
  953. echo -e ""
  954. {
  955. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  956. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  957. } | column -s $'\t' -t
  958. }
  959. fn_info_message_source(){
  960. echo -e "netstat -atunp | grep srcds_linux"
  961. echo -e ""
  962. {
  963. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  964. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
  965. echo -e "> SourceTV\tINBOUND\t${sourcetvport}\tudp"
  966. echo -e "< Client\tOUTBOUND\t${clientport}\tudp"
  967. } | column -s $'\t' -t
  968. }
  969. fn_info_message_spark(){
  970. fn_info_message_password_strip
  971. echo -e "netstat -atunp | grep server_linux"
  972. echo -e ""
  973. {
  974. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  975. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  976. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  977. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
  978. } | column -s $'\t' -t
  979. echo -e ""
  980. echo -e "${lightgreen}${servername} WebAdmin${default}"
  981. fn_messages_separator
  982. {
  983. echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}/index.html"
  984. echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}"
  985. echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}"
  986. } | column -s $'\t' -t
  987. }
  988. fn_info_message_squad(){
  989. echo -e "netstat -atunp | grep SquadServer"
  990. echo -e ""
  991. {
  992. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  993. echo -e "> Game\tINBOUND\t${port}\tudp"
  994. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  995. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  996. } | column -s $'\t' -t
  997. }
  998. fn_info_message_starbound(){
  999. echo -e "netstat -atunp | grep starbound"
  1000. echo -e ""
  1001. {
  1002. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1003. echo -e "> Game\tINBOUND\t${port}\ttcp"
  1004. echo -e "> Query\tINBOUND\t${queryport}\ttcp"
  1005. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  1006. } | column -s $'\t' -t
  1007. }
  1008. fn_info_message_stationeers(){
  1009. echo -e "netstat -atunp | grep rocketstation"
  1010. echo -e ""
  1011. {
  1012. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1013. echo -e "> Game\tINBOUND\t${port}\ttcp"
  1014. echo -e "> Query\tINBOUND\t${queryport}\ttcp"
  1015. } | column -s $'\t' -t
  1016. }
  1017. fn_info_message_teamspeak3(){
  1018. echo -e "netstat -atunp | grep ts3server"
  1019. echo -e ""
  1020. {
  1021. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1022. echo -e "> Voice\tINBOUND\t${port}\tudp"
  1023. echo -e "> ServerQuery\tINBOUND\t${queryport}\ttcp"
  1024. echo -e "> File transfer\tINBOUND\t${fileport}\ttcp"
  1025. } | column -s $'\t' -t
  1026. }
  1027. fn_info_message_teeworlds(){
  1028. echo -e "netstat -atunp | grep teeworlds"
  1029. echo -e ""
  1030. {
  1031. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1032. echo -e "> Game\Query\tINBOUND\t${port}\ttcp"
  1033. } | column -s $'\t' -t
  1034. }
  1035. fn_info_message_terraria(){
  1036. echo -e "netstat -atunp | grep Terraria"
  1037. echo -e ""
  1038. {
  1039. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1040. echo -e "> Game\tINBOUND\t${port}\ttcp"
  1041. } | column -s $'\t' -t
  1042. }
  1043. fn_info_message_towerunite(){
  1044. echo -e "netstat -atunp | grep TowerServer"
  1045. echo -e ""
  1046. {
  1047. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1048. echo -e "> Game\tINBOUND\t${port}\ttcp"
  1049. # Don't do arithmetics if ever the port wasn't a numeric value
  1050. if [ "${port}" -eq "${port}" ]; then
  1051. echo -e "> Steam\tINBOUND\t$((port+1))\tudp"
  1052. fi
  1053. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1054. } | column -s $'\t' -t
  1055. }
  1056. fn_info_message_unreal(){
  1057. fn_info_message_password_strip
  1058. echo -e "netstat -atunp | grep ucc-bin"
  1059. echo -e ""
  1060. {
  1061. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL\tINI VARIABLE"
  1062. echo -e "> Game\tINBOUND\t${port}\tudp\tPort=${port}"
  1063. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1064. if [ "${engine}" == "unreal" ]; then
  1065. echo -e "< UdpLink Port (random)\tOUTBOUND\t${udplinkport}+\tudp"
  1066. fi
  1067. if [ "${engine}" != "unreal" ]&&[ "${appid}" != "223250" ]; then
  1068. echo -e "> Query (GameSpy)\tINBOUND\t${queryportgs}\tudp\tOldQueryPortNumber=${queryportgs}"
  1069. fi
  1070. if [ "${appid}" == "215360" ]; then
  1071. echo -e "< Master server\tOUTBOUND\t28852\ttcp/udp"
  1072. else
  1073. echo -e "< Master server\tOUTBOUND\t28900/28902\ttcp/udp"
  1074. fi
  1075. if [ "${appid}" ]; then
  1076. if [ "${appid}" == "223250" ]; then
  1077. echo -e "< Steam\tINBOUND\t20610\tudp"
  1078. else
  1079. echo -e "< Steam\tINBOUND\t20660\tudp"
  1080. fi
  1081. fi
  1082. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp\tListenPort=${webadminport}"
  1083. } | column -s $'\t' -t
  1084. echo -e ""
  1085. echo -e "${lightgreen}${servername} WebAdmin${default}"
  1086. fn_messages_separator
  1087. {
  1088. echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}"
  1089. echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
  1090. echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}"
  1091. echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}"
  1092. } | column -s $'\t' -t
  1093. }
  1094. fn_info_message_unreal2(){
  1095. fn_info_message_password_strip
  1096. echo -e "netstat -atunp | grep ucc-bin"
  1097. echo -e ""
  1098. {
  1099. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL\tINI VARIABLE"
  1100. echo -e "> Game\tINBOUND\t${port}\tudp\tPort=${port}"
  1101. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1102. if [ "${appid}" != "223250" ]; then
  1103. echo -e "> Query (GameSpy)\tINBOUND\t${queryportgs}\tudp\tOldQueryPortNumber=${queryportgs}"
  1104. fi
  1105. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp\tListenPort=${webadminport}"
  1106. } | column -s $'\t' -t
  1107. echo -e ""
  1108. echo -e "${lightgreen}${servername} WebAdmin${default}"
  1109. fn_messages_separator
  1110. {
  1111. echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}"
  1112. echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
  1113. echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}"
  1114. echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}"
  1115. } | column -s $'\t' -t
  1116. }
  1117. fn_info_message_unreal3(){
  1118. fn_info_message_password_strip
  1119. echo -e "netstat -atunp | grep ut3-bin"
  1120. echo -e ""
  1121. {
  1122. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1123. echo -e "> Game\tINBOUND\t${port}\tudp"
  1124. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1125. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp\tListenPort=${webadminport}"
  1126. } | column -s $'\t' -t
  1127. echo -e ""
  1128. echo -e "${lightgreen}${servername} WebAdmin${default}"
  1129. fn_messages_separator
  1130. {
  1131. echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}"
  1132. echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
  1133. echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}"
  1134. echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}"
  1135. } | column -s $'\t' -t
  1136. }
  1137. fn_info_message_unturned(){
  1138. echo -e "netstat -atunp | grep Unturned"
  1139. echo -e ""
  1140. {
  1141. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1142. echo -e "> Game\tINBOUND\t${port}\tudp"
  1143. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1144. } | column -s $'\t' -t
  1145. }
  1146. fn_info_message_ut(){
  1147. echo -e "netstat -atunp | grep UE4Server"
  1148. echo -e ""
  1149. {
  1150. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1151. echo -e "> Game\tINBOUND\t${port}\tudp"
  1152. } | column -s $'\t' -t
  1153. }
  1154. fn_info_message_kf2(){
  1155. fn_info_message_password_strip
  1156. echo -e "netstat -atunp | grep KFGame"
  1157. echo -e ""
  1158. {
  1159. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1160. echo -e "> Game\tINBOUND\t${port}\ttcp\tPort=${port}"
  1161. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1162. echo -e "> Steam\tINBOUND\t20560\tudp"
  1163. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp\tListenPort=${webadminport}"
  1164. } | column -s $'\t' -t
  1165. echo -e ""
  1166. echo -e "${lightgreen}${servername} WebAdmin${default}"
  1167. fn_messages_separator
  1168. {
  1169. echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}"
  1170. echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
  1171. echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}"
  1172. echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}"
  1173. } | column -s $'\t' -t
  1174. }
  1175. fn_info_message_wolfensteinenemyterritory(){
  1176. echo -e "netstat -atunp | grep etded"
  1177. echo -e ""
  1178. {
  1179. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1180. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  1181. } | column -s $'\t' -t
  1182. }
  1183. fn_info_message_wurmunlimited(){
  1184. echo -e "netstat -atunp | grep WurmServer"
  1185. echo -e ""
  1186. {
  1187. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1188. echo -e "> Game\tINBOUND\t${port}\ttcp"
  1189. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1190. } | column -s $'\t' -t
  1191. }
  1192. fn_info_message_mta(){
  1193. echo -e "netstat -atunp | grep mta-server"
  1194. echo -e ""
  1195. {
  1196. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1197. echo -e "> Game/Query\tOUTBOUND\t${port}\tudp"
  1198. echo -e "> HTTP Server\tINBOUND\t${httpport}\ttcp"
  1199. if [ "${ase}" == "Enabled" ]; then
  1200. echo -e "> Query Port\tOUTBOUND\t${queryport}\tudp"
  1201. fi
  1202. } | column -s $'\t' -t
  1203. }
  1204. fn_info_message_mordhau(){
  1205. echo -e "netstat -atunp | grep Mord"
  1206. echo -e ""
  1207. {
  1208. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1209. echo -e "> Game\tINBOUND\t${port}\tudp"
  1210. echo -e "> BeaconPort\tINBOUND\t${beaconport}\tudp"
  1211. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1212. } | column -s $'\t' -t
  1213. }
  1214. fn_info_message_barotrauma(){
  1215. echo -e "netstat -atunp | grep /./Server.bin"
  1216. echo -e ""
  1217. {
  1218. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1219. echo -e "> Game\tINBOUND\t${port}\tudp"
  1220. echo -e "> Query\tINBOUND\t$((port+1))\tudp"
  1221. } | column -s $'\t' -t
  1222. }
  1223. fn_info_message_soldat() {
  1224. echo -e "netstat -atunp | grep soldat"
  1225. echo -e ""
  1226. {
  1227. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1228. echo -e "> Game\tINBOUND\t${port}\tudp"
  1229. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1230. echo -e "> FILES\tINBOUND\t$((port+10))\ttcp"
  1231. } | column -s $'\t' -t
  1232. }
  1233. fn_info_message_warfork(){
  1234. echo -e "netstat -atunp | grep wf_server"
  1235. echo -e ""
  1236. {
  1237. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1238. echo -e "> Game\tINBOUND\t${port}\tudp"
  1239. echo -e "> HTTP\tINBOUND\t${httpport}\ttcp"
  1240. } | column -s $'\t' -t
  1241. }
  1242. fn_info_message_select_engine(){
  1243. # Display details depending on game or engine.
  1244. if [ "${shortname}" == "ac" ]; then
  1245. fn_info_message_assettocorsa
  1246. elif [ "${shortname}" == "ark" ]; then
  1247. fn_info_message_ark
  1248. elif [ "${shortname}" == "av" ]; then
  1249. fn_info_message_avorion
  1250. elif [ "${shortname}" == "arma3" ]; then
  1251. fn_info_message_arma3
  1252. elif [ "${shortname}" == "bo" ]; then
  1253. fn_info_message_ballisticoverkill
  1254. elif [ "${shortname}" == "bt" ]; then
  1255. fn_info_message_barotrauma
  1256. elif [ "${shortname}" == "bt1944" ]; then
  1257. fn_info_message_battalion1944
  1258. elif [ "${shortname}" == "cod" ]; then
  1259. fn_info_message_cod
  1260. elif [ "${shortname}" == "coduo" ]; then
  1261. fn_info_message_coduo
  1262. elif [ "${shortname}" == "cod2" ]; then
  1263. fn_info_message_cod2
  1264. elif [ "${shortname}" == "cod4" ]; then
  1265. fn_info_message_cod4
  1266. elif [ "${shortname}" == "codwaw" ]; then
  1267. fn_info_message_codwaw
  1268. elif [ "${shortname}" == "dst" ]; then
  1269. fn_info_message_dst
  1270. elif [ "${shortname}" == "eco" ]; then
  1271. fn_info_message_eco
  1272. elif [ "${shortname}" == "etl" ]; then
  1273. fn_info_message_etlegacy
  1274. elif [ "${shortname}" == "fctr" ]; then
  1275. fn_info_message_factorio
  1276. elif [ "${shortname}" == "hw" ]; then
  1277. fn_info_message_hurtworld
  1278. elif [ "${shortname}" == "inss" ]; then
  1279. fn_info_message_inss
  1280. elif [ "${shortname}" == "jc2" ]; then
  1281. fn_info_message_justcause2
  1282. elif [ "${shortname}" == "jc3" ]; then
  1283. fn_info_message_justcause3
  1284. elif [ "${shortname}" == "kf2" ]; then
  1285. fn_info_message_kf2
  1286. elif [ "${shortname}" == "mcb" ]; then
  1287. fn_info_message_minecraft_bedrock
  1288. elif [ "${shortname}" == "onset" ]; then
  1289. fn_info_message_onset
  1290. elif [ "${shortname}" == "pz" ]; then
  1291. fn_info_message_projectzomboid
  1292. elif [ "${shortname}" == "pstbs" ]; then
  1293. fn_info_message_pstbs
  1294. elif [ "${shortname}" == "pc" ]; then
  1295. fn_info_message_projectcars
  1296. elif [ "${shortname}" == "qw" ]; then
  1297. fn_info_message_quake
  1298. elif [ "${shortname}" == "q2" ]; then
  1299. fn_info_message_quake2
  1300. elif [ "${shortname}" == "q3" ]; then
  1301. fn_info_message_quake3
  1302. elif [ "${shortname}" == "ql" ]; then
  1303. fn_info_message_quakelive
  1304. elif [ "${shortname}" == "samp" ]; then
  1305. fn_info_message_samp
  1306. elif [ "${shortname}" == "sdtd" ]; then
  1307. fn_info_message_sdtd
  1308. elif [ "${shortname}" == "squad" ]; then
  1309. fn_info_message_squad
  1310. elif [ "${shortname}" == "st" ]; then
  1311. fn_info_message_stationeers
  1312. elif [ "${shortname}" == "sof2" ]; then
  1313. fn_info_message_sof2
  1314. elif [ "${shortname}" == "sol" ]; then
  1315. fn_info_message_soldat
  1316. elif [ "${shortname}" == "st" ]; then
  1317. fn_info_message_starbound
  1318. elif [ "${shortname}" == "sbots" ]; then
  1319. fn_info_message_sbots
  1320. elif [ "${shortname}" == "ss3" ]; then
  1321. fn_info_message_ss3
  1322. elif [ "${shortname}" == "terraria" ]; then
  1323. fn_info_message_terraria
  1324. elif [ "${shortname}" == "ts3" ]; then
  1325. fn_info_message_teamspeak3
  1326. elif [ "${shortname}" == "tu" ]; then
  1327. fn_info_message_towerunite
  1328. elif [ "${shortname}" == "tw" ]; then
  1329. fn_info_message_teeworlds
  1330. elif [ "${shortname}" == "unt" ]; then
  1331. fn_info_message_unturned
  1332. elif [ "${shortname}" == "ut" ]; then
  1333. fn_info_message_ut
  1334. elif [ "${shortname}" == "mc" ]; then
  1335. fn_info_message_minecraft
  1336. elif [ "${shortname}" == "mh" ]; then
  1337. fn_info_message_mordhau
  1338. elif [ "${shortname}" == "mohaa" ]; then
  1339. fn_info_message_mohaa
  1340. elif [ "${shortname}" == "mta" ]; then
  1341. fn_info_message_mta
  1342. elif [ "${shortname}" == "mumble" ]; then
  1343. fn_info_message_mumble
  1344. elif [ "${engine}" == "bf1942" ]; then
  1345. fn_info_message_bf1942
  1346. elif [ "${shortname}" == "rtcw" ]; then
  1347. fn_info_message_rtcw
  1348. elif [ "${shortname}" == "rust" ]; then
  1349. fn_info_message_rust
  1350. elif [ "${shortname}" == "wf" ]; then
  1351. fn_info_message_warfork
  1352. elif [ "${shortname}" == "wurm" ]; then
  1353. fn_info_message_wurmunlimited
  1354. elif [ "${shortname}" == "rw" ]; then
  1355. fn_info_message_risingworld
  1356. elif [ "${shortname}" == "wet" ]; then
  1357. fn_info_message_wolfensteinenemyterritory
  1358. elif [ "${engine}" == "goldsrc" ]; then
  1359. fn_info_message_goldsrc
  1360. elif [ "${engine}" == "source" ]; then
  1361. fn_info_message_source
  1362. elif [ "${engine}" == "spark" ]; then
  1363. fn_info_message_spark
  1364. elif [ "${engine}" == "unreal" ]; then
  1365. fn_info_message_unreal
  1366. elif [ "${engine}" == "unreal2" ]; then
  1367. fn_info_message_unreal2
  1368. elif [ "${engine}" == "unreal3" ]; then
  1369. fn_info_message_unreal3
  1370. else
  1371. fn_print_error_nl "Unable to detect server engine."
  1372. fi
  1373. }
  1374. # Separator is different for details
  1375. fn_messages_separator(){
  1376. if [ "${function_selfname}" == "command_details.sh" ]; then
  1377. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  1378. else
  1379. echo -e "================================="
  1380. fi
  1381. }
  1382. # Removes the passwords form all but details
  1383. fn_info_message_password_strip(){
  1384. if [ "${function_selfname}" != "command_details.sh" ]; then
  1385. if [ "${serverpassword}" ]; then
  1386. serverpassword="********"
  1387. fi
  1388. if [ "${rconpassword}" ]; then
  1389. rconpassword="********"
  1390. fi
  1391. if [ "${adminpassword}" ]; then
  1392. adminpassword="********"
  1393. fi
  1394. if [ "${statspassword}" ]; then
  1395. statspassword="********"
  1396. fi
  1397. if [ "${webadminpass}" ]; then
  1398. webadminpass="********"
  1399. fi
  1400. if [ "${telnetpass}" ]; then
  1401. telnetpass="********"
  1402. fi
  1403. if [ "${wsapikey}" ]; then
  1404. wsapikey="********"
  1405. fi
  1406. if [ "${gslt}" ]; then
  1407. gslt="********"
  1408. fi
  1409. fi
  1410. }