info_messages.sh 38 KB

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