info_messages.sh 37 KB

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