mumbleserver 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #!/bin/bash
  2. # Mumble
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Website: https://gameservermanagers.com
  6. if [ -f ".dev-debug" ]; then
  7. exec 5>dev-debug.log
  8. BASH_XTRACEFD="5"
  9. set -x
  10. fi
  11. version="210516"
  12. #### Variables ####
  13. # Notification Alerts
  14. # (on|off)
  15. # Email
  16. emailalert="off"
  17. email="email@example.com"
  18. # Pushbullet
  19. # https://www.pushbullet.com/#settings
  20. pushbulletalert="off"
  21. pushbullettoken="accesstoken"
  22. # Server Details
  23. gamename="Mumble"
  24. servicename="mumble-server"
  25. # Directories
  26. rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
  27. selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  28. lockselfname=".${servicename}.lock"
  29. lgsmdir="${rootdir}/lgsm"
  30. functionsdir="${lgsmdir}/functions"
  31. filesdir="${rootdir}/serverfiles"
  32. systemdir="${filesdir}"
  33. executabledir="${filesdir}"
  34. executable="./murmur.x86"
  35. servercfg="murmur.ini"
  36. servercfgdir="${filesdir}"
  37. servercfgfullpath="${servercfgdir}/${servercfg}"
  38. backupdir="${rootdir}/backups"
  39. # Logging
  40. logdays="7"
  41. logdir="${rootdir}/log"
  42. scriptlogdir="${rootdir}/log/script"
  43. consolelogdir="${rootdir}/log/console"
  44. consolelogging="on"
  45. scriptlog="${scriptlogdir}/${servicename}-script.log"
  46. consolelog="${consolelogdir}/${servicename}-console.log"
  47. emaillog="${scriptlogdir}/${servicename}-email.log"
  48. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  49. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  50. fn_parms(){
  51. parms="-fg -ini ${servercfgfullpath}"
  52. }
  53. # Github Branch Select
  54. # Allows for the use of different function files
  55. # from a different repo and/or branch.
  56. githubuser="dgibbs64"
  57. githubrepo="linuxgsm"
  58. githubbranch="master"
  59. ##### Script #####
  60. # Do not edit
  61. # Fetches core_dl for file downloads
  62. fn_fetch_core_dl(){
  63. github_file_url_dir="lgsm/functions"
  64. github_file_url_name="${functionfile}"
  65. filedir="${functionsdir}"
  66. filename="${github_file_url_name}"
  67. githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
  68. # If the file is missing, then download
  69. if [ ! -f "${filedir}/${filename}" ]; then
  70. if [ ! -d "${filedir}" ]; then
  71. mkdir -p "${filedir}"
  72. fi
  73. echo -e " fetching ${filename}...\c"
  74. # Check curl exists and use available path
  75. curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
  76. for curlcmd in ${curlpaths}
  77. do
  78. if [ -x "${curlcmd}" ]; then
  79. break
  80. fi
  81. done
  82. # If curl exists download file
  83. if [ "$(basename ${curlcmd})" == "curl" ]; then
  84. curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
  85. if [ $? -ne 0 ]; then
  86. echo -e "\e[0;31mFAIL\e[0m\n"
  87. echo "${curlfetch}"
  88. echo -e "${githuburl}\n"
  89. exit 1
  90. else
  91. echo -e "\e[0;32mOK\e[0m"
  92. fi
  93. else
  94. echo -e "\e[0;31mFAIL\e[0m\n"
  95. echo "Curl is not installed!"
  96. echo -e ""
  97. exit 1
  98. fi
  99. chmod +x "${filedir}/${filename}"
  100. fi
  101. source "${filedir}/${filename}"
  102. }
  103. core_dl.sh(){
  104. # Functions are defined in core_functions.sh.
  105. functionfile="${FUNCNAME}"
  106. fn_fetch_core_dl
  107. }
  108. core_functions.sh(){
  109. # Functions are defined in core_functions.sh.
  110. functionfile="${FUNCNAME}"
  111. fn_fetch_core_dl
  112. }
  113. core_dl.sh
  114. core_functions.sh
  115. getopt=$1
  116. core_getopt.sh