core_getopt.sh 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. #!/bin/bash
  2. # LGSM core_getopt.sh function
  3. # Author: Daniel Gibbs
  4. # Website: https://gameservermanagers.com
  5. # Description: getopt arguments.
  6. local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  7. fn_getopt_generic(){
  8. case "${getopt}" in
  9. st|start)
  10. command_start.sh;;
  11. sp|stop)
  12. command_stop.sh;;
  13. r|restart)
  14. command_restart.sh;;
  15. u|update)
  16. command_update.sh;;
  17. fu|force-update|update-restart)
  18. forceupdate=1;
  19. command_update.sh;;
  20. uf|update-functions)
  21. command_update_functions.sh;;
  22. v|validate)
  23. command_validate.sh;;
  24. m|monitor)
  25. command_monitor.sh;;
  26. ta|test-alert)
  27. command_test_alert.sh;;
  28. dt|details)
  29. command_details.sh;;
  30. pd|postdetails)
  31. command_postdetails.sh;;
  32. b|backup)
  33. command_backup.sh;;
  34. c|console)
  35. command_console.sh;;
  36. d|debug)
  37. command_debug.sh;;
  38. dev|dev-debug)
  39. command_dev_debug.sh;;
  40. i|install)
  41. command_install.sh;;
  42. ai|auto-install)
  43. fn_autoinstall;;
  44. dd|detect-deps)
  45. command_dev_detect_deps.sh;;
  46. dg|detect-glibc)
  47. command_dev_detect_glibc.sh;;
  48. dl|detect-ldd)
  49. command_dev_detect_ldd.sh;;
  50. *)
  51. if [ -n "${getopt}" ]; then
  52. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  53. exitcode=2
  54. fi
  55. echo "Usage: $0 [option]"
  56. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  57. echo "https://gameservermanagers.com/${selfname}"
  58. echo -e ""
  59. echo -e "${lightyellow}Commands${default}"
  60. {
  61. echo -e "${blue}start\t${default}st |Start the server."
  62. echo -e "${blue}stop\t${default}sp |Stop the server."
  63. echo -e "${blue}restart\t${default}r |Restart the server."
  64. echo -e "${blue}update\t${default}u |Checks and applies updates from SteamCMD."
  65. echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
  66. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  67. echo -e "${blue}validate\t${default}v |Validate server files with SteamCMD."
  68. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  69. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  70. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  71. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  72. echo -e "${blue}backup\t${default}b |Create archive of the server."
  73. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  74. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  75. echo -e "${blue}install\t${default}i |Install the server."
  76. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  77. } | column -s $'\t' -t
  78. esac
  79. }
  80. fn_getopt_generic_no_update(){
  81. case "${getopt}" in
  82. st|start)
  83. command_start.sh;;
  84. sp|stop)
  85. command_stop.sh;;
  86. r|restart)
  87. command_restart.sh;;
  88. uf|update-functions)
  89. command_update_functions.sh;;
  90. m|monitor)
  91. command_monitor.sh;;
  92. ta|test-alert)
  93. command_test_alert.sh;;
  94. dt|details)
  95. command_details.sh;;
  96. pd|postdetails)
  97. command_postdetails.sh;;
  98. b|backup)
  99. command_backup.sh;;
  100. c|console)
  101. command_console.sh;;
  102. d|debug)
  103. command_debug.sh;;
  104. dev|dev-debug)
  105. command_dev_debug.sh;;
  106. i|install)
  107. command_install.sh;;
  108. ai|auto-install)
  109. fn_autoinstall;;
  110. dd|detect-deps)
  111. command_dev_detect_deps.sh;;
  112. dg|detect-glibc)
  113. command_dev_detect_glibc.sh;;
  114. dl|detect-ldd)
  115. command_dev_detect_ldd.sh;;
  116. *)
  117. if [ -n "${getopt}" ]; then
  118. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  119. exitcode=2
  120. fi
  121. echo "Usage: $0 [option]"
  122. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  123. echo "https://gameservermanagers.com/${selfname}"
  124. echo -e ""
  125. echo -e "${lightyellow}Commands${default}"
  126. {
  127. echo -e "${blue}start\t${default}st |Start the server."
  128. echo -e "${blue}stop\t${default}sp |Stop the server."
  129. echo -e "${blue}restart\t${default}r |Restart the server."
  130. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  131. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  132. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  133. echo -e "${blue}details\t${default}dt |Displays useful infomation about the server."
  134. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  135. echo -e "${blue}backup\t${default}b |Create archive of the server."
  136. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  137. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  138. echo -e "${blue}install\t${default}i |Install the server."
  139. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  140. } | column -s $'\t' -t
  141. esac
  142. }
  143. fn_getopt_teamspeak3(){
  144. case "${getopt}" in
  145. st|start)
  146. command_start.sh;;
  147. sp|stop)
  148. command_stop.sh;;
  149. r|restart)
  150. command_restart.sh;;
  151. u|update)
  152. command_update.sh;;
  153. uf|update-functions)
  154. command_update_functions.sh;;
  155. m|monitor)
  156. command_monitor.sh;;
  157. ta|test-alert)
  158. command_test_alert.sh;;
  159. dt|details)
  160. command_details.sh;;
  161. pd|postdetails)
  162. command_postdetails.sh;;
  163. b|backup)
  164. command_backup.sh;;
  165. pw|change-password)
  166. command_ts3_server_pass.sh;;
  167. dev|dev-debug)
  168. command_dev_debug.sh;;
  169. i|install)
  170. command_install.sh;;
  171. ai|auto-install)
  172. fn_autoinstall;;
  173. dd|detect-deps)
  174. command_dev_detect_deps.sh;;
  175. dg|detect-glibc)
  176. command_dev_detect_glibc.sh;;
  177. dl|detect-ldd)
  178. command_dev_detect_ldd.sh;;
  179. *)
  180. if [ -n "${getopt}" ]; then
  181. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  182. exitcode=2
  183. fi
  184. echo "Usage: $0 [option]"
  185. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  186. echo "https://gameservermanagers.com/${selfname}"
  187. echo -e ""
  188. echo -e "${lightyellow}Commands${default}"
  189. {
  190. echo -e "${blue}start\t${default}st |Start the server."
  191. echo -e "${blue}stop\t${default}sp |Stop the server."
  192. echo -e "${blue}restart\t${default}r |Restart the server."
  193. echo -e "${blue}update\t${default}u |Checks and applies updates from teamspeak.com."
  194. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  195. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  196. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  197. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  198. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  199. echo -e "${blue}change-password\t${default}pw |Changes TS3 serveradmin password."
  200. echo -e "${blue}backup\t${default}b |Create archive of the server."
  201. echo -e "${blue}install\t${default}i |Install the server."
  202. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  203. } | column -s $'\t' -t
  204. esac
  205. }
  206. fn_getopt_minecraft(){
  207. case "${getopt}" in
  208. st|start)
  209. command_start.sh;;
  210. sp|stop)
  211. command_stop.sh;;
  212. r|restart)
  213. command_restart.sh;;
  214. u|update)
  215. command_update.sh;;
  216. uf|update-functions)
  217. command_update_functions.sh;;
  218. m|monitor)
  219. command_monitor.sh;;
  220. ta|test-alert)
  221. command_test_alert.sh;;
  222. dt|details)
  223. command_details.sh;;
  224. pd|postdetails)
  225. command_postdetails.sh;;
  226. b|backup)
  227. command_backup.sh;;
  228. c|console)
  229. command_console.sh;;
  230. d|debug)
  231. command_debug.sh;;
  232. dev|dev-debug)
  233. command_dev_debug.sh;;
  234. i|install)
  235. command_install.sh;;
  236. ai|auto-install)
  237. fn_autoinstall;;
  238. dd|detect-deps)
  239. command_dev_detect_deps.sh;;
  240. dg|detect-glibc)
  241. command_dev_detect_glibc.sh;;
  242. dl|detect-ldd)
  243. command_dev_detect_ldd.sh;;
  244. *)
  245. if [ -n "${getopt}" ]; then
  246. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  247. exitcode=2
  248. fi
  249. echo "Usage: $0 [option]"
  250. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  251. echo "https://gameservermanagers.com/${selfname}"
  252. echo -e ""
  253. echo -e "${lightyellow}Commands${default}"
  254. {
  255. echo -e "${blue}start\t${default}st |Start the server."
  256. echo -e "${blue}stop\t${default}sp |Stop the server."
  257. echo -e "${blue}restart\t${default}r |Restart the server."
  258. echo -e "${blue}update\t${default}u |Checks and applies updates from mojang.com."
  259. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  260. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  261. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  262. echo -e "${blue}details\t${default}dt |Displays useful infomation about the server."
  263. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  264. echo -e "${blue}backup\t${default}b |Create archive of the server."
  265. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  266. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  267. echo -e "${blue}install\t${default}i |Install the server."
  268. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  269. } | column -s $'\t' -t
  270. esac
  271. }
  272. fn_getopt_mumble(){
  273. case "${getopt}" in
  274. st|start)
  275. command_start.sh;;
  276. sp|stop)
  277. command_stop.sh;;
  278. r|restart)
  279. command_restart.sh;;
  280. u|update)
  281. command_update.sh;;
  282. uf|update-functions)
  283. command_update_functions.sh;;
  284. m|monitor)
  285. command_monitor.sh;;
  286. ta|test-alert)
  287. command_test_alert.sh;;
  288. dt|details)
  289. command_details.sh;;
  290. pd|postdetails)
  291. command_postdetails.sh;;
  292. b|backup)
  293. command_backup.sh;;
  294. dev|dev-debug)
  295. command_dev_debug.sh;;
  296. c|console)
  297. command_console.sh;;
  298. i|install)
  299. command_install.sh;;
  300. dd|detect-deps)
  301. command_dev_detect_deps.sh;;
  302. dg|detect-glibc)
  303. command_dev_detect_glibc.sh;;
  304. dl|detect-ldd)
  305. command_dev_detect_ldd.sh;;
  306. *)
  307. if [ -n "${getopt}" ]; then
  308. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  309. exitcode=2
  310. fi
  311. echo "Usage: $0 [option]"
  312. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  313. echo "https://gameservermanagers.com/${selfname}"
  314. echo -e ""
  315. echo -e "${lightyellow}Commands${default}"
  316. {
  317. echo -e "${blue}start\t${default}st |Start the server."
  318. echo -e "${blue}stop\t${default}sp |Stop the server."
  319. echo -e "${blue}restart\t${default}r |Restart the server."
  320. echo -e "${blue}update\t${default}u |Checks and applies updates from GitHub."
  321. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  322. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  323. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  324. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  325. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  326. echo -e "${blue}backup\t${default}b |Create archive of the server."
  327. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  328. echo -e "${blue}install\t${default}i |Install the server."
  329. } | column -s $'\t' -t
  330. esac
  331. }
  332. fn_getopt_gmodserver(){
  333. case "${getopt}" in
  334. st|start)
  335. command_start.sh;;
  336. sp|stop)
  337. command_stop.sh;;
  338. r|restart)
  339. command_restart.sh;;
  340. u|update)
  341. command_update.sh;;
  342. fu|force-update|update-restart)
  343. forceupdate=1;
  344. command_update.sh;;
  345. uf|update-functions)
  346. command_update_functions.sh;;
  347. v|validate)
  348. command_validate.sh;;
  349. m|monitor)
  350. command_monitor.sh;;
  351. ta|test-alert)
  352. command_test_alert.sh;;
  353. dt|details)
  354. command_details.sh;;
  355. pd|postdetails)
  356. command_postdetails.sh;;
  357. b|backup)
  358. command_backup.sh;;
  359. c|console)
  360. command_console.sh;;
  361. d|debug)
  362. command_debug.sh;;
  363. dev|dev-debug)
  364. command_dev_debug.sh;;
  365. i|install)
  366. command_install.sh;;
  367. ai|auto-install)
  368. fn_autoinstall;;
  369. dd|detect-deps)
  370. command_dev_detect_deps.sh;;
  371. dg|detect-glibc)
  372. command_dev_detect_glibc.sh;;
  373. dl|detect-ldd)
  374. command_dev_detect_ldd.sh;;
  375. fd|fastdl)
  376. command_fastdl.sh;;
  377. *)
  378. if [ -n "${getopt}" ]; then
  379. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  380. exitcode=2
  381. fi
  382. echo "Usage: $0 [option]"
  383. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  384. echo "https://gameservermanagers.com/${selfname}"
  385. echo -e ""
  386. echo -e "${lightyellow}Commands${default}"
  387. {
  388. echo -e "${blue}start\t${default}st |Start the server."
  389. echo -e "${blue}stop\t${default}sp |Stop the server."
  390. echo -e "${blue}restart\t${default}r |Restart the server."
  391. echo -e "${blue}update\t${default}u |Checks and applies updates from SteamCMD."
  392. echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
  393. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  394. echo -e "${blue}validate\t${default}v |Validate server files with SteamCMD."
  395. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  396. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  397. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  398. echo -e "${blue}backup\t${default}b |Create archive of the server."
  399. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  400. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  401. echo -e "${blue}install\t${default}i |Install the server."
  402. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  403. echo -e "${blue}fastdl\t${default}fd |Generates or update a FastDL directory for your server."
  404. } | column -s $'\t' -t
  405. esac
  406. }
  407. fn_getopt_unreal(){
  408. case "${getopt}" in
  409. st|start)
  410. command_start.sh;;
  411. sp|stop)
  412. command_stop.sh;;
  413. r|restart)
  414. command_restart.sh;;
  415. uf|update-functions)
  416. command_update_functions.sh;;
  417. m|monitor)
  418. command_monitor.sh;;
  419. ta|test-alert)
  420. command_test_alert.sh;;
  421. dt|details)
  422. command_details.sh;;
  423. b|backup)
  424. command_backup.sh;;
  425. c|console)
  426. command_console.sh;;
  427. d|debug)
  428. command_debug.sh;;
  429. dev|dev-debug)
  430. command_dev_debug.sh;;
  431. i|install)
  432. command_install.sh;;
  433. ai|auto-install)
  434. fn_autoinstall;;
  435. mc|map-compressor)
  436. compress_ut99_maps.sh;;
  437. dd|detect-deps)
  438. command_dev_detect_deps.sh;;
  439. dg|detect-glibc)
  440. command_dev_detect_glibc.sh;;
  441. dl|detect-ldd)
  442. command_dev_detect_ldd.sh;;
  443. *)
  444. if [ -n "${getopt}" ]; then
  445. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  446. exitcode=2
  447. fi
  448. echo "Usage: $0 [option]"
  449. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  450. echo "https://gameservermanagers.com/${selfname}"
  451. echo -e ""
  452. echo -e "${lightyellow}Commands${default}"
  453. {
  454. echo -e "${blue}start\t${default}st |Start the server."
  455. echo -e "${blue}stop\t${default}sp |Stop the server."
  456. echo -e "${blue}restart\t${default}r |Restart the server."
  457. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  458. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  459. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  460. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  461. echo -e "${blue}backup\t${default}b |Create archive of the server."
  462. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  463. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  464. echo -e "${blue}install\t${default}i |Install the server."
  465. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  466. echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
  467. } | column -s $'\t' -t
  468. esac
  469. }
  470. fn_getopt_unreal2(){
  471. case "${getopt}" in
  472. st|start)
  473. command_start.sh;;
  474. sp|stop)
  475. command_stop.sh;;
  476. r|restart)
  477. command_restart.sh;;
  478. u|update)
  479. command_update.sh;;
  480. fu|force-update|update-restart)
  481. forceupdate=1;
  482. command_update.sh;;
  483. uf|update-functions)
  484. command_update_functions.sh;;
  485. v|validate)
  486. command_validate.sh;;
  487. m|monitor)
  488. command_monitor.sh;;
  489. ta|test-alert)
  490. command_test_alert.sh;;
  491. dt|details)
  492. command_details.sh;;
  493. b|backup)
  494. command_backup.sh;;
  495. c|console)
  496. command_console.sh;;
  497. d|debug)
  498. command_debug.sh;;
  499. dev|dev-debug)
  500. command_dev_debug.sh;;
  501. i|install)
  502. command_install.sh;;
  503. ai|auto-install)
  504. fn_autoinstall;;
  505. dd|detect-deps)
  506. command_dev_detect_deps.sh;;
  507. dg|detect-glibc)
  508. command_dev_detect_glibc.sh;;
  509. dl|detect-ldd)
  510. command_dev_detect_ldd.sh;;
  511. mc|map-compressor)
  512. compress_unreal2_maps.sh;;
  513. *)
  514. if [ -n "${getopt}" ]; then
  515. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  516. exitcode=2
  517. fi
  518. echo "Usage: $0 [option]"
  519. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  520. echo "https://gameservermanagers.com/${selfname}"
  521. echo -e ""
  522. echo -e "${lightyellow}Commands${default}"
  523. {
  524. echo -e "${blue}start\t${default}st |Start the server."
  525. echo -e "${blue}stop\t${default}sp |Stop the server."
  526. echo -e "${blue}restart\t${default}r |Restart the server."
  527. echo -e "${blue}update\t${default}Checks and applies updates from SteamCMD."
  528. echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
  529. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  530. echo -e "${blue}validate\t${default}v |Validate server files with SteamCMD."
  531. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  532. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  533. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  534. echo -e "${blue}backup\t${default}b |Create archive of the server."
  535. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  536. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  537. echo -e "${blue}install\t${default}i |Install the server."
  538. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  539. echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
  540. } | column -s $'\t' -t
  541. esac
  542. }
  543. fn_getopt_ut2k4(){
  544. case "${getopt}" in
  545. st|start)
  546. command_start.sh;;
  547. sp|stop)
  548. command_stop.sh;;
  549. r|restart)
  550. command_restart.sh;;
  551. uf|update-functions)
  552. command_update_functions.sh;;
  553. m|monitor)
  554. command_monitor.sh;;
  555. ta|test-alert)
  556. command_test_alert.sh;;
  557. dt|details)
  558. command_details.sh;;
  559. b|backup)
  560. command_backup.sh;;
  561. c|console)
  562. command_console.sh;;
  563. d|debug)
  564. command_debug.sh;;
  565. dev|dev-debug)
  566. command_dev_debug.sh;;
  567. i|install)
  568. command_install.sh;;
  569. ai|auto-install)
  570. fn_autoinstall;;
  571. cd|server-cd-key)
  572. install_ut2k4_key.sh;;
  573. mc|map-compressor)
  574. compress_unreal2_maps.sh;;
  575. dd|detect-deps)
  576. command_dev_detect_deps.sh;;
  577. dg|detect-glibc)
  578. command_dev_detect_glibc.sh;;
  579. dl|detect-ldd)
  580. command_dev_detect_ldd.sh;;
  581. *)
  582. if [ -n "${getopt}" ]; then
  583. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  584. exitcode=2
  585. fi
  586. echo "Usage: $0 [option]"
  587. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  588. echo "https://gameservermanagers.com/${selfname}"
  589. echo -e ""
  590. echo -e "${lightyellow}Commands${default}"
  591. {
  592. echo -e "${blue}start\t${default}st |Start the server."
  593. echo -e "${blue}stop\t${default}sp |Stop the server."
  594. echo -e "${blue}restart\t${default}r |Restart the server."
  595. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  596. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  597. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  598. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  599. echo -e "${blue}backup\t${default}b |Create archive of the server."
  600. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  601. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  602. echo -e "${blue}install\t${default}i |Install the server."
  603. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  604. echo -e "${blue}server-cd-key\t${default}cd |Add your server cd key"
  605. echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
  606. } | column -s $'\t' -t
  607. esac
  608. }
  609. if [ "${gamename}" == "Mumble" ]; then
  610. fn_getopt_mumble
  611. elif [ "${gamename}" == "Battlefield: 1942" ]||[ "${gamename}" == "Quake 3: Arena" ]||[ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
  612. fn_getopt_generic_no_update
  613. elif [ "${engine}" == "lwjgl2" ]; then
  614. fn_getopt_minecraft
  615. elif [ "${gamename}" == "TeamSpeak 3" ]; then
  616. fn_getopt_teamspeak3
  617. elif [ "${gamename}" == "Garry's Mod" ]; then
  618. fn_getopt_gmodserver
  619. elif [ "${engine}" == "unreal2" ]; then
  620. if [ "${gamename}" == "Unreal Tournament 2004" ]; then
  621. fn_getopt_ut2k4
  622. else
  623. fn_getopt_unreal2
  624. fi
  625. elif [ "${engine}" == "unreal" ]; then
  626. fn_getopt_unreal
  627. else
  628. fn_getopt_generic
  629. fi
  630. core_exit.sh