info_messages.sh 45 KB

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