mumbleserver 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. echo -e "\e[0;31mFAIL\e[0m\n"
  63. echo "Curl is not installed!"
  64. echo -e ""
  65. exit
  66. fi
  67. CURL=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1)
  68. if [ $? -ne 0 ]; then
  69. echo -e "\e[0;31mFAIL\e[0m\n"
  70. echo " $CURL"|grep "curl:"
  71. echo -e "${githuburl}\n"
  72. exit
  73. else
  74. echo -e "\e[0;32mOK\e[0m"
  75. fi
  76. if [ "${exec}" ]; then
  77. chmod +x "${filepath}"
  78. fi
  79. fi
  80. if [ "${exec}" ]; then
  81. source "${filepath}"
  82. fi
  83. }
  84. fn_runfunction(){
  85. fn_getgithubfile "functions/${functionfile}" 1
  86. }
  87. fn_functions(){
  88. # Functions are defined in fn_functions.
  89. functionfile="${FUNCNAME}"
  90. fn_runfunction
  91. }
  92. fn_functions
  93. getopt=$1
  94. fn_getopt