ts3server 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/bash
  2. # Teamspeak 3
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Website: http://gameservermanagers.com
  6. # Version: 030515
  7. #### Variables ####
  8. # Notification Email
  9. # (on|off)
  10. emailnotification="off"
  11. email="email@example.com"
  12. # Server Details
  13. gamename="Teamspeak 3"
  14. servername="Teamspeak 3 Server"
  15. servicename="ts3-server"
  16. # Directories
  17. rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  18. selfname="$(basename $0)"
  19. lockselfname=".${servicename}.lock"
  20. filesdir="${rootdir}/serverfiles"
  21. systemdir="${filesdir}"
  22. executabledir="${filesdir}"
  23. executable="./ts3server_startscript.sh"
  24. servercfgdir="${filesdir}"
  25. servercfg="${servicename}.ini"
  26. servercfgfullpath="${servercfgdir}/${servercfg}"
  27. defaultcfg="${servercfgfullpath}" #
  28. backupdir="${rootdir}/backups"
  29. # Logging
  30. logdays="7"
  31. gamelogdir="${filesdir}/logs"
  32. scriptlogdir="${rootdir}/log/script"
  33. scriptlog="${scriptlogdir}/${servicename}-script.log"
  34. emaillog="${scriptlogdir}/${servicename}-email.log"
  35. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  36. ##### Script #####
  37. # Do not edit
  38. fn_runfunction(){
  39. # Functions are downloaded and run with this function
  40. if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
  41. cd "${rootdir}"
  42. if [ ! -d "functions" ]; then
  43. mkdir functions
  44. fi
  45. cd functions
  46. echo -e "loading ${functionfile}...\c"
  47. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/functions/${functionfile} 2>&1 | grep -F HTTP | cut -c45-
  48. chmod +x "${functionfile}"
  49. cd "${rootdir}"
  50. sleep 1
  51. fi
  52. source "${rootdir}/functions/${functionfile}"
  53. }
  54. fn_functions(){
  55. # Functions are defined in fn_functions.
  56. functionfile="${FUNCNAME}"
  57. fn_runfunction
  58. }
  59. fn_functions
  60. getopt=$1
  61. fn_getopt