twserver 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #!/bin/bash
  2. # Teeworlds
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Contributor: Bryce Van Dyk (SingingTree)
  6. # Website: http://gameservermanagers.com
  7. version="281015"
  8. #### Variables ####
  9. # Notification Email
  10. # (on|off)
  11. emailnotification="off"
  12. email="email@example.com"
  13. # Steam login
  14. steamuser="username"
  15. steampass="password"
  16. # Start Variables
  17. ip="0.0.0.0"
  18. updateonstart="off"
  19. fn_parms(){
  20. parms="-f ${servercfgfullpath}"
  21. }
  22. #### Advanced Variables ####
  23. # Steam
  24. appid="380840"
  25. # Server Details
  26. servicename="tw-server"
  27. gamename="Teeworlds"
  28. engine="teeworlds"
  29. # Directories
  30. rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  31. selfname="$(basename $0)"
  32. lockselfname=".${servicename}.lock"
  33. filesdir="${rootdir}/serverfiles"
  34. systemdir="${filesdir}"
  35. executabledir="${filesdir}"
  36. executable="./teeworlds_srv"
  37. servercfg="${servicename}.cfg" # Teeworlds can also auto load any config if an autoexec.cfg file is present in the server dir
  38. servercfgdir="${filesdir}"
  39. servercfgfullpath="${servercfgdir}/${servercfg}"
  40. servercfgdefault="${servercfgdir}/lgsm-default.cfg"
  41. backupdir="${rootdir}/backups"
  42. # Logging
  43. logdays="7"
  44. gamelogdir="${rootdir}/log/server"
  45. scriptlogdir="${rootdir}/log/script"
  46. consolelogdir="${rootdir}/log/console"
  47. gamelog="${gamelogdir}/${servicename}-game.log"
  48. scriptlog="${scriptlogdir}/${servicename}-script.log"
  49. consolelog="${consolelogdir}/${servicename}-console.log"
  50. emaillog="${scriptlogdir}/${servicename}-email.log"
  51. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  52. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  53. ##### Script #####
  54. # Do not edit
  55. fn_runfunction(){
  56. # Functions are downloaded and run with this function
  57. if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
  58. cd "${rootdir}"
  59. if [ ! -d "functions" ]; then
  60. mkdir functions
  61. fi
  62. cd functions
  63. echo -e " loading ${functionfile}...\c"
  64. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/functions/${functionfile} 2>&1 | grep -F HTTP | cut -c45-
  65. chmod +x "${functionfile}"
  66. cd "${rootdir}"
  67. fi
  68. source "${rootdir}/functions/${functionfile}"
  69. }
  70. fn_functions(){
  71. # Functions are defined in fn_functions.
  72. functionfile="${FUNCNAME}"
  73. fn_runfunction
  74. }
  75. fn_functions
  76. getopt=$1
  77. fn_getopt