mumbleserver 2.5 KB

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