mumbleserver 3.1 KB

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