info_messages.sh 39 KB

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