info_messages.sh 41 KB

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