mumbleserver 3.0 KB

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