mumbleserver 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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="201215"
  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. fn_getgithubfile(){
  54. filename=$1
  55. exec=$2
  56. fileurl=${3:-$filename}
  57. filepath="${rootdir}/${filename}"
  58. filedir=$(dirname "${filepath}")
  59. # If the function file is missing, then download
  60. if [ ! -f "${filepath}" ]; then
  61. if [ ! -d "${filedir}" ]; then
  62. mkdir "${filedir}"
  63. fi
  64. githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}"
  65. echo -e " fetching ${filename}...\c"
  66. if [ "$(command -v curl)" ]||[ "$(which curl >/dev/null 2>&1)" ]||[ -f "/usr/bin/curl" ]||[ -f "/bin/curl" ]; then
  67. :
  68. else
  69. echo -e "\e[0;31mFAIL\e[0m\n"
  70. echo "Curl is not installed!"
  71. echo -e ""
  72. exit
  73. fi
  74. curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1)
  75. if [ $? -ne 0 ]; then
  76. echo -e "\e[0;31mFAIL\e[0m\n"
  77. echo "${curl}"
  78. echo -e "${githuburl}\n"
  79. exit
  80. else
  81. echo -e "\e[0;32mOK\e[0m"
  82. fi
  83. if [ "${exec}" ]; then
  84. chmod +x "${filepath}"
  85. fi
  86. fi
  87. if [ "${exec}" ]; then
  88. source "${filepath}"
  89. fi
  90. }
  91. fn_runfunction(){
  92. fn_getgithubfile "functions/${functionfile}" 1
  93. }
  94. core_functions.sh(){
  95. # Functions are defined in core_functions.sh.
  96. functionfile="${FUNCNAME}"
  97. fn_runfunction
  98. }
  99. core_functions.sh
  100. getopt=$1
  101. core_getopt.sh