4
0

ts3server 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/bash
  2. # Teamspeak 3
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Website: http://danielgibbs.co.uk
  6. # Version: 080214
  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. fn_parms(){
  17. parms="-game fof -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
  18. }
  19. # Directories
  20. rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  21. selfname="$(basename $0)"
  22. lockselfname=".${servicename}.lock"
  23. filesdir="${rootdir}/serverfiles"
  24. systemdir="${filesdir}"
  25. executabledir="${filesdir}"
  26. executable="./ts3server_startscript.sh"
  27. servercfgdir="${filesdir}"
  28. servercfg="${servicename}.ini"
  29. servercfgfullpath="${servercfgdir}/${servercfg}"
  30. defaultcfg="${servercfgfullpath}" #
  31. backupdir="${rootdir}/backups"
  32. # Logging
  33. logdays="7"
  34. gamelogdir="${filesdir}/logs"
  35. scriptlogdir="${rootdir}/log/script"
  36. scriptlog="${scriptlogdir}/${servicename}-script.log"
  37. emaillog="${scriptlogdir}/${servicename}-email.log"
  38. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  39. ##### Script #####
  40. # Do not edit
  41. fn_runfunction(){
  42. # Functions are downloaded and run with this function
  43. if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
  44. cd "${rootdir}"
  45. if [ ! -d "functions" ]; then
  46. mkdir functions
  47. fi
  48. cd functions
  49. echo -e "loading ${functionfile}...\c"
  50. wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/functions/${functionfile} 2>&1 | grep -F HTTP | cut -c45-
  51. chmod +x "${functionfile}"
  52. cd "${rootdir}"
  53. sleep 1
  54. fi
  55. source "${rootdir}/functions/${functionfile}"
  56. }
  57. fn_functions(){
  58. # Functions are defined in fn_functions.
  59. functionfile="${FUNCNAME}"
  60. fn_runfunction
  61. }
  62. fn_functions
  63. getopt=$1
  64. fn_getopt