mumbleserver 3.0 KB

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