info_messages.sh 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473
  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. # 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}${servicename}"
  366. # LinuxGSM version
  367. if [ -n "${version}" ]; then
  368. echo -e "${lightblue}LinuxGSM version:\t${default}${version}"
  369. fi
  370. # glibc required
  371. if [ -n "${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 [ -n "${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 [ -n "${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 [ -n "${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" "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 "${servicename} Logs"
  514. echo -e "================================="
  515. if [ -n "${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 [ -n "${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 [ -n "${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_dontstarve(){
  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}\ttcp"
  664. } | column -s $'\t' -t
  665. }
  666. fn_info_message_goldsource(){
  667. echo -e "netstat -atunp | grep hlds_linux"
  668. echo -e ""
  669. {
  670. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  671. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
  672. echo -e "< Client\tOUTBOUND\t${clientport}\tudp"
  673. } | column -s $'\t' -t
  674. }
  675. fn_info_message_hurtworld(){
  676. echo -e "netstat -atunp | grep Hurtworld"
  677. echo -e ""
  678. {
  679. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  680. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  681. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  682. } | column -s $'\t' -t
  683. }
  684. fn_info_message_inss(){
  685. echo -e "netstat -atunp | grep Insurgency"
  686. echo -e ""
  687. {
  688. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  689. echo -e "> Game\tINBOUND\t${port}\tudp"
  690. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  691. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  692. } | column -s $'\t' -t
  693. }
  694. fn_info_message_justcause2(){
  695. echo -e "netstat -atunp | grep Jcmp-Server"
  696. echo -e ""
  697. {
  698. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  699. echo -e "> Game\tINBOUND\t${port}\tudp"
  700. } | column -s $'\t' -t
  701. }
  702. fn_info_message_justcause3(){
  703. echo -e "netstat -atunp | grep Server"
  704. echo -e ""
  705. {
  706. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  707. echo -e "> Game\tINBOUND\t${port}\tudp"
  708. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  709. echo -e "> Steam\tINBOUND\t${steamport}\tudp"
  710. } | column -s $'\t' -t
  711. }
  712. fn_info_message_minecraft(){
  713. echo -e "netstat -atunp | grep java"
  714. echo -e ""
  715. {
  716. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  717. echo -e "> Game\tINBOUND\t${port}\ttcp"
  718. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  719. echo -e "> Rcon\tINBOUND\t${rconport}\ttcp"
  720. } | column -s $'\t' -t
  721. }
  722. fn_info_message_mohaa(){
  723. echo -e "netstat -atunp | grep mohaa_lnxded"
  724. echo -e ""
  725. {
  726. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
  727. echo -e "> Game\tINBOUND\t${port}\tudp"
  728. } | column -s $'\t' -t
  729. }
  730. fn_info_message_mumble(){
  731. echo -e "netstat -atunp | grep murmur"
  732. echo -e ""
  733. {
  734. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  735. echo -e "> Voice\tINBOUND\t${port}\tudp"
  736. echo -e "> ServerQuery\tINBOUND\t${port}\ttcp"
  737. } | column -s $'\t' -t
  738. }
  739. fn_info_message_pstbs(){
  740. echo -e "netstat -atunp | grep PostScriptum"
  741. echo -e ""
  742. {
  743. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  744. echo -e "> Game\tINBOUND\t${port}\tudp"
  745. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  746. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  747. } | column -s $'\t' -t
  748. }
  749. fn_info_message_projectcars(){
  750. echo -e "netstat -atunp | grep DedicatedS"
  751. echo -e ""
  752. {
  753. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  754. echo -e "> Game\tINBOUND\t${port}\tudp"
  755. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  756. echo -e "> Steam\tINBOUND\t${steamport}\tudp"
  757. } | column -s $'\t' -t
  758. }
  759. fn_info_message_projectzomboid(){
  760. echo -e "netstat -atunp | grep java"
  761. echo -e ""
  762. {
  763. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  764. echo -e "> Game\tINBOUND\t${port}\tudp"
  765. } | column -s $'\t' -t
  766. }
  767. fn_info_message_quake(){
  768. echo -e "netstat -atunp | grep mvdsv"
  769. echo -e ""
  770. {
  771. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  772. echo -e "> Game\tINBOUND\t${port}\tudp"
  773. } | column -s $'\t' -t
  774. }
  775. fn_info_message_quake2(){
  776. echo -e "netstat -atunp | grep quake2"
  777. echo -e ""
  778. {
  779. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  780. echo -e "> Game\tINBOUND\t${port}\tudp"
  781. } | column -s $'\t' -t
  782. }
  783. fn_info_message_quake3(){
  784. echo -e "netstat -atunp | grep q3ded"
  785. echo -e ""
  786. {
  787. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  788. echo -e "> Game\tINBOUND\t${port}\tudp"
  789. } | column -s $'\t' -t
  790. }
  791. fn_info_message_quakelive(){
  792. echo -e "netstat -atunp | grep qzeroded"
  793. echo -e ""
  794. if [ -z "${port}" ]||[ -z "${rconport}" ]||[ -z "${statsport}" ]; then
  795. echo -e "${red}ERROR!${default} Missing/commented ports in ${servercfg}."
  796. echo -e ""
  797. fi
  798. {
  799. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  800. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  801. echo -e "> Rcon\tINBOUND\t${rconport}\tudp"
  802. echo -e "> Stats\tINBOUND\t${statsport}\tudp"
  803. } | column -s $'\t' -t
  804. }
  805. fn_info_message_realvirtuality(){
  806. echo -e "netstat -atunp | grep arma3server"
  807. echo -e ""
  808. # Default port
  809. if [ -z "${port}" ]; then
  810. port="2302"
  811. fi
  812. {
  813. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  814. echo -e "> Game\tINBOUND\t${port}\tudp"
  815. # Don't do arithmetics if ever the port wasn't a numeric value
  816. if [ "${port}" -eq "${port}" ]; then
  817. echo -e "> Steam: Query\tINBOUND\t$((port+1))\tudp"
  818. echo -e "> Steam: Master traffic\tINBOUND\t$((port+2))\tudp"
  819. echo -e "> Undocumented Port\tINBOUND\t$((port+3))\tudp"
  820. fi
  821. } | column -s $'\t' -t
  822. }
  823. fn_info_message_refractor(){
  824. echo -e "netstat -atunp | grep bf1942_lnxd"
  825. echo -e ""
  826. {
  827. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  828. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  829. echo -e "> Steam: Query\tINBOUND\t${queryport}\tudp"
  830. } | column -s $'\t' -t
  831. }
  832. fn_info_message_risingworld(){
  833. echo -e "netstat -atunp | grep java"
  834. echo -e ""
  835. {
  836. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  837. echo -e "> Game/Query\tINBOUND\t${port}\ttcp/udp"
  838. echo -e "> http query\tINBOUND\t${httpqueryport}\ttcp"
  839. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  840. } | column -s $'\t' -t
  841. }
  842. fn_info_message_rtcw(){
  843. echo -e "netstat -atunp | grep iowolfded"
  844. echo -e ""
  845. {
  846. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  847. echo -e "> Game\tINBOUND\t${port}\tudp"
  848. } | column -s $'\t' -t
  849. }
  850. fn_info_message_rust(){
  851. echo -e "netstat -atunp | grep Rust"
  852. echo -e ""
  853. {
  854. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  855. echo -e "> Game/Query\tINBOUND\t${port}\ttcp/udp"
  856. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  857. } | column -s $'\t' -t
  858. }
  859. fn_info_message_samp(){
  860. echo -e "netstat -atunp | grep samp03svr"
  861. echo -e ""
  862. {
  863. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  864. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
  865. } | column -s $'\t' -t
  866. }
  867. fn_info_message_seriousengine35(){
  868. echo -e "netstat -atunp | grep Sam3_Dedicate"
  869. echo -e ""
  870. {
  871. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  872. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp"
  873. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  874. } | column -s $'\t' -t
  875. }
  876. fn_info_message_sbots(){
  877. echo -e "netstat -atunp | grep blank1"
  878. echo -e ""
  879. {
  880. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  881. echo -e "> Game\tINBOUND\t${port}\tudp"
  882. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  883. } | column -s $'\t' -t
  884. }
  885. fn_info_message_sdtd(){
  886. fn_info_message_password_strip
  887. echo -e "netstat -atunp | grep 7DaysToDie"
  888. echo -e ""
  889. {
  890. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  891. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  892. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  893. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
  894. echo -e "> Telnet\tINBOUND\t${telnetport}\ttcp"
  895. } | column -s $'\t' -t
  896. echo -e ""
  897. echo -e "${lightgreen}${servername} WebAdmin${default}"
  898. fn_messages_separator
  899. {
  900. echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}"
  901. echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
  902. echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}"
  903. } | column -s $'\t' -t
  904. echo -e ""
  905. echo -e "${lightgreen}${servername} Telnet${default}"
  906. fn_messages_separator
  907. {
  908. echo -e "${lightblue}Telnet enabled:\t${default}${telnetenabled}"
  909. echo -e "${lightblue}Telnet address:\t${default}${ip} ${telnetport}"
  910. echo -e "${lightblue}Telnet password:\t${default}${telnetpass}"
  911. } | column -s $'\t' -t
  912. }
  913. fn_info_message_sof2(){
  914. echo -e "netstat -atunp | grep sof2ded"
  915. echo -e ""
  916. {
  917. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  918. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  919. } | column -s $'\t' -t
  920. }
  921. fn_info_message_source(){
  922. echo -e "netstat -atunp | grep srcds_linux"
  923. echo -e ""
  924. {
  925. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  926. echo -e "> Game/RCON\tINBOUND\t${port}\ttcp/udp"
  927. echo -e "> SourceTV\tINBOUND\t${sourcetvport}\tudp"
  928. echo -e "< Client\tOUTBOUND\t${clientport}\tudp"
  929. } | column -s $'\t' -t
  930. }
  931. fn_info_message_spark(){
  932. fn_info_message_password_strip
  933. echo -e "netstat -atunp | grep server_linux"
  934. echo -e ""
  935. {
  936. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  937. echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
  938. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  939. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp"
  940. } | column -s $'\t' -t
  941. echo -e ""
  942. echo -e "${lightgreen}${servername} WebAdmin${default}"
  943. fn_messages_separator
  944. {
  945. echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}/index.html"
  946. echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}"
  947. echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}"
  948. } | column -s $'\t' -t
  949. }
  950. fn_info_message_squad(){
  951. echo -e "netstat -atunp | grep SquadServer"
  952. echo -e ""
  953. {
  954. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  955. echo -e "> Game\tINBOUND\t${port}\tudp"
  956. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  957. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  958. } | column -s $'\t' -t
  959. }
  960. fn_info_message_starbound(){
  961. echo -e "netstat -atunp | grep starbound"
  962. echo -e ""
  963. {
  964. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  965. echo -e "> Game\tINBOUND\t${port}\ttcp"
  966. echo -e "> Query\tINBOUND\t${queryport}\ttcp"
  967. echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
  968. } | column -s $'\t' -t
  969. }
  970. fn_info_message_stationeers(){
  971. echo -e "netstat -atunp | grep rocketstation"
  972. echo -e ""
  973. {
  974. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  975. echo -e "> Game\tINBOUND\t${port}\ttcp"
  976. echo -e "> Query\tINBOUND\t${queryport}\ttcp"
  977. } | column -s $'\t' -t
  978. }
  979. fn_info_message_teamspeak3(){
  980. echo -e "netstat -atunp | grep ts3server"
  981. echo -e ""
  982. {
  983. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  984. echo -e "> Voice\tINBOUND\t${port}\tudp"
  985. echo -e "> ServerQuery\tINBOUND\t${queryport}\ttcp"
  986. echo -e "> File transfer\tINBOUND\t${fileport}\ttcp"
  987. } | column -s $'\t' -t
  988. }
  989. fn_info_message_teeworlds(){
  990. echo -e "netstat -atunp | grep teeworlds_srv"
  991. echo -e ""
  992. {
  993. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  994. echo -e "> Game\tINBOUND\t${port}\ttcp"
  995. } | column -s $'\t' -t
  996. }
  997. fn_info_message_terraria(){
  998. echo -e "netstat -atunp | grep TerrariaServer"
  999. echo -e ""
  1000. {
  1001. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1002. echo -e "> Game\tINBOUND\t${port}\ttcp"
  1003. } | column -s $'\t' -t
  1004. }
  1005. fn_info_message_towerunite(){
  1006. echo -e "netstat -atunp | grep TowerServer"
  1007. echo -e ""
  1008. {
  1009. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1010. echo -e "> Game\tINBOUND\t${port}\ttcp"
  1011. # Don't do arithmetics if ever the port wasn't a numeric value
  1012. if [ "${port}" -eq "${port}" ]; then
  1013. echo -e "> Steam\tINBOUND\t$((port+1))\tudp"
  1014. fi
  1015. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1016. } | column -s $'\t' -t
  1017. }
  1018. fn_info_message_unreal(){
  1019. fn_info_message_password_strip
  1020. echo -e "netstat -atunp | grep ucc-bin"
  1021. echo -e ""
  1022. {
  1023. echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL\tINI VARIABLE"
  1024. echo -e "> Game\tINBOUND\t${port}\tudp\tPort=${port}"
  1025. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1026. if [ "${engine}" == "unreal" ]; then
  1027. echo -e "< UdpLink Port (random)\tOUTBOUND\t${udplinkport}+\tudp"
  1028. fi
  1029. if [ "${engine}" != "unreal" ]&&[ "${appid}" != "223250" ]; then
  1030. echo -e "> GameSpy query\tINBOUND\t${gsqueryport}\tudp\tOldQueryPortNumber=${gsqueryport}"
  1031. fi
  1032. if [ "${appid}" == "215360" ]; then
  1033. echo -e "< Master server\tOUTBOUND\t28852\ttcp/udp"
  1034. else
  1035. echo -e "< Master server\tOUTBOUND\t28900/28902\ttcp/udp"
  1036. fi
  1037. if [ "${appid}" ]; then
  1038. if [ "${appid}" == "223250" ]; then
  1039. echo -e "< Steam\tINBOUND\t20610\tudp"
  1040. else
  1041. echo -e "< Steam\tINBOUND\t20660\tudp"
  1042. fi
  1043. fi
  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_unreal3(){
  1057. fn_info_message_password_strip
  1058. echo -e "netstat -atunp | grep ut3-bin"
  1059. echo -e ""
  1060. {
  1061. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1062. echo -e "> Game\tINBOUND\t${port}\tudp"
  1063. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  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_unturned(){
  1077. echo -e "netstat -atunp | grep Unturned"
  1078. echo -e ""
  1079. {
  1080. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1081. echo -e "> Game\tINBOUND\t${port}\tudp"
  1082. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1083. } | column -s $'\t' -t
  1084. }
  1085. fn_info_message_kf2(){
  1086. fn_info_message_password_strip
  1087. echo -e "netstat -atunp | grep KFGame"
  1088. echo -e ""
  1089. {
  1090. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1091. echo -e "> Game\tINBOUND\t${port}\ttcp\tPort=${port}"
  1092. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1093. echo -e "> Steam\tINBOUND\t20560\tudp"
  1094. echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp\tListenPort=${webadminport}"
  1095. } | column -s $'\t' -t
  1096. echo -e ""
  1097. echo -e "${lightgreen}${servername} WebAdmin${default}"
  1098. fn_messages_separator
  1099. {
  1100. echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}"
  1101. echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
  1102. echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}"
  1103. echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}"
  1104. } | column -s $'\t' -t
  1105. }
  1106. fn_info_message_wolfensteinenemyterritory(){
  1107. echo -e "netstat -atunp | grep etded"
  1108. echo -e ""
  1109. {
  1110. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1111. echo -e "> Game/Query\tINBOUND\t${port}\tudp"
  1112. } | column -s $'\t' -t
  1113. }
  1114. fn_info_message_wurmunlimited(){
  1115. echo -e "netstat -atunp | grep WurmServer"
  1116. echo -e ""
  1117. {
  1118. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1119. echo -e "> Game\tINBOUND\t${port}\ttcp"
  1120. echo -e "> Game/Query\tINBOUND\t${queryport}\tudp"
  1121. } | column -s $'\t' -t
  1122. }
  1123. fn_info_message_mta(){
  1124. echo -e "netstat -atunp | grep mta-server64"
  1125. echo -e ""
  1126. {
  1127. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1128. echo -e "> Game\tOUTBOUND\t${port}\tudp"
  1129. echo -e "> HTTP Server\tINBOUND\t${httpport}\ttcp"
  1130. if [ "${ase}" == "Enabled" ]; then
  1131. echo -e "> ASE Game_Monitor\tOUTBOUND\t$((${port} + 123))\tudp"
  1132. fi
  1133. } | column -s $'\t' -t
  1134. }
  1135. fn_info_message_mordhau(){
  1136. echo -e "netstat -atunp | grep Mord"
  1137. echo -e ""
  1138. {
  1139. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1140. echo -e "> Game\tINBOUND\t${port}\tudp"
  1141. echo -e "> BeaconPort\tINBOUND\t${beaconport}\tudp"
  1142. echo -e "> Query\tINBOUND\t${queryport}\tudp"
  1143. } | column -s $'\t' -t
  1144. }
  1145. fn_info_message_barotrauma(){
  1146. echo -e "netstat -atunp | grep /./Server.bin"
  1147. echo -e ""
  1148. {
  1149. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1150. echo -e "> Game\tINBOUND\t${port}\tudp"
  1151. echo -e "> Query\tINBOUND\t$((port+1))\tudp"
  1152. } | column -s $'\t' -t
  1153. }
  1154. fn_info_message_soldat() {
  1155. echo -e "netstat -atunp | grep soldat"
  1156. echo -e ""
  1157. {
  1158. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1159. echo -e "> Game\tINBOUND\t${port}\tudp"
  1160. echo -e "> RCON\tINBOUND\t${port}\ttcp"
  1161. echo -e "> FILES\tINBOUND\t$((port+10))\ttcp"
  1162. } | column -s $'\t' -t
  1163. }
  1164. fn_info_message_warfork(){
  1165. echo -e "netstat -atunp | grep wf_server"
  1166. echo -e ""
  1167. {
  1168. echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
  1169. echo -e "> Game\tINBOUND\t${port}\tudp"
  1170. echo -e "> HTTP\tINBOUND\t${httpport}\ttcp"
  1171. } | column -s $'\t' -t
  1172. }
  1173. fn_info_message_select_engine(){
  1174. # Display details depending on game or engine.
  1175. if [ "${shortname}" == "sdtd" ]; then
  1176. fn_info_message_sdtd
  1177. elif [ "${shortname}" == "ark" ]; then
  1178. fn_info_message_ark
  1179. elif [ "${shortname}" == "bo" ]; then
  1180. fn_info_message_ballisticoverkill
  1181. elif [ "${shortname}" == "bt" ]; then
  1182. fn_info_message_barotrauma
  1183. elif [ "${shortname}" == "bt1944" ]; then
  1184. fn_info_message_battalion1944
  1185. elif [ "${shortname}" == "cod" ]; then
  1186. fn_info_message_cod
  1187. elif [ "${shortname}" == "coduo" ]; then
  1188. fn_info_message_coduo
  1189. elif [ "${shortname}" == "cod2" ]; then
  1190. fn_info_message_cod2
  1191. elif [ "${shortname}" == "cod4" ]; then
  1192. fn_info_message_cod4
  1193. elif [ "${shortname}" == "codwaw" ]; then
  1194. fn_info_message_codwaw
  1195. elif [ "${shortname}" == "eco" ]; then
  1196. fn_info_message_eco
  1197. elif [ "${shortname}" == "etl" ]; then
  1198. fn_info_message_etlegacy
  1199. elif [ "${shortname}" == "fctr" ]; then
  1200. fn_info_message_factorio
  1201. elif [ "${shortname}" == "hw" ]; then
  1202. fn_info_message_hurtworld
  1203. elif [ "${shortname}" == "inss" ]; then
  1204. fn_info_message_inss
  1205. elif [ "${shortname}" == "jc2" ]; then
  1206. fn_info_message_justcause2
  1207. elif [ "${shortname}" == "jc3" ]; then
  1208. fn_info_message_justcause3
  1209. elif [ "${shortname}" == "kf2" ]; then
  1210. fn_info_message_kf2
  1211. elif [ "${shortname}" == "pstbs" ]; then
  1212. fn_info_message_pstbs
  1213. elif [ "${shortname}" == "pc" ]; then
  1214. fn_info_message_projectcars
  1215. elif [ "${shortname}" == "qw" ]; then
  1216. fn_info_message_quake
  1217. elif [ "${shortname}" == "q2" ]; then
  1218. fn_info_message_quake2
  1219. elif [ "${shortname}" == "q3" ]; then
  1220. fn_info_message_quake3
  1221. elif [ "${shortname}" == "ql" ]; then
  1222. fn_info_message_quakelive
  1223. elif [ "${shortname}" == "samp" ]; then
  1224. fn_info_message_samp
  1225. elif [ "${shortname}" == "squad" ]; then
  1226. fn_info_message_squad
  1227. elif [ "${shortname}" == "st" ]; then
  1228. fn_info_message_stationeers
  1229. elif [ "${shortname}" == "sof2" ]; then
  1230. fn_info_message_sof2
  1231. elif [ "${shortname}" == "sol" ]; then
  1232. fn_info_message_soldat
  1233. elif [ "${shortname}" == "sbots" ]; then
  1234. fn_info_message_sbots
  1235. elif [ "${shortname}" == "ts3" ]; then
  1236. fn_info_message_teamspeak3
  1237. elif [ "${shortname}" == "tu" ]; then
  1238. fn_info_message_towerunite
  1239. elif [ "${shortname}" == "unt" ]; then
  1240. fn_info_message_unturned
  1241. elif [ "${shortname}" == "mohaa" ]; then
  1242. fn_info_message_mohaa
  1243. elif [ "${shortname}" == "mh" ]; then
  1244. fn_info_message_mordhau
  1245. elif [ "${shortname}" == "mta" ]; then
  1246. fn_info_message_mta
  1247. elif [ "${shortname}" == "mumble" ]; then
  1248. fn_info_message_mumble
  1249. elif [ "${shortname}" == "rtcw" ]; then
  1250. fn_info_message_rtcw
  1251. elif [ "${shortname}" == "rust" ]; then
  1252. fn_info_message_rust
  1253. elif [ "${shortname}" == "wf" ]; then
  1254. fn_info_message_warfork
  1255. elif [ "${shortname}" == "wurm" ]; then
  1256. fn_info_message_wurmunlimited
  1257. elif [ "${shortname}" == "rw" ]; then
  1258. fn_info_message_risingworld
  1259. elif [ "${shortname}" == "wet" ]; then
  1260. fn_info_message_wolfensteinenemyterritory
  1261. elif [ "${engine}" == "refractor" ]; then
  1262. fn_info_message_refractor
  1263. elif [ "${engine}" == "dontstarve" ]; then
  1264. fn_info_message_dontstarve
  1265. elif [ "${engine}" == "goldsource" ]; then
  1266. fn_info_message_goldsource
  1267. elif [ "${engine}" == "lwjgl2" ]; then
  1268. fn_info_message_minecraft
  1269. elif [ "${engine}" == "projectzomboid" ]; then
  1270. fn_info_message_projectzomboid
  1271. elif [ "${engine}" == "realvirtuality" ]; then
  1272. fn_info_message_realvirtuality
  1273. elif [ "${engine}" == "seriousengine35" ]; then
  1274. fn_info_message_seriousengine35
  1275. elif [ "${engine}" == "source" ]; then
  1276. fn_info_message_source
  1277. elif [ "${engine}" == "spark" ]; then
  1278. fn_info_message_spark
  1279. elif [ "${engine}" == "starbound" ]; then
  1280. fn_info_message_starbound
  1281. elif [ "${engine}" == "teeworlds" ]; then
  1282. fn_info_message_teeworlds
  1283. elif [ "${engine}" == "terraria" ]; then
  1284. fn_info_message_terraria
  1285. elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
  1286. fn_info_message_unreal
  1287. elif [ "${engine}" == "unreal3" ]; then
  1288. fn_info_message_unreal3
  1289. else
  1290. fn_print_error_nl "Unable to detect server engine."
  1291. fi
  1292. }
  1293. # Separator is different for details
  1294. fn_messages_separator(){
  1295. if [ "${function_selfname}" == "command_details.sh" ]; then
  1296. printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  1297. else
  1298. echo -e "================================="
  1299. fi
  1300. }
  1301. # Removes the passwords form all but details
  1302. fn_info_message_password_strip(){
  1303. if [ "${function_selfname}" != "command_details.sh" ]; then
  1304. if [ -n "${serverpassword}" ]; then
  1305. serverpassword="********"
  1306. fi
  1307. if [ -n "${rconpassword}" ]; then
  1308. rconpassword="********"
  1309. fi
  1310. if [ -n "${adminpassword}" ]; then
  1311. adminpassword="********"
  1312. fi
  1313. if [ -n "${statspassword}" ]; then
  1314. statspassword="********"
  1315. fi
  1316. if [ -n "${webadminpass}" ]; then
  1317. webadminpass="********"
  1318. fi
  1319. if [ -n "${telnetpass}" ]; then
  1320. telnetpass="********"
  1321. fi
  1322. if [ -n "${wsapikey}" ]; then
  1323. wsapikey="********"
  1324. fi
  1325. if [ -n "${gslt}" ]; then
  1326. gslt="********"
  1327. fi
  1328. fi
  1329. }