4
0

twserver 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #!/bin/bash
  2. # Terraria
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Contributor: Bryce Van Dyk (SingingTree)
  6. # Website: http://gameservermanagers.com
  7. version="071015"
  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. backupdir="${rootdir}/backups"
  41. # Logging
  42. logdays="7"
  43. #gamelogdir="" # Teeworlds has a configurable logfile location, use 'logfile' in server.cfg
  44. scriptlogdir="${rootdir}/log/script"
  45. consolelogdir="${rootdir}/log/console"
  46. scriptlog="${scriptlogdir}/${servicename}-script.log"
  47. consolelog="${consolelogdir}/${servicename}-console.log"
  48. emaillog="${scriptlogdir}/${servicename}-email.log"
  49. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  50. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  51. ##### Script #####
  52. # Do not edit
  53. fn_runfunction(){
  54. # Functions are downloaded and run with this function
  55. if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
  56. cd "${rootdir}"
  57. if [ ! -d "functions" ]; then
  58. mkdir functions
  59. fi
  60. cd functions
  61. echo -e " loading ${functionfile}...\c"
  62. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/functions/${functionfile} 2>&1 | grep -F HTTP | cut -c45-
  63. chmod +x "${functionfile}"
  64. cd "${rootdir}"
  65. fi
  66. source "${rootdir}/functions/${functionfile}"
  67. }
  68. fn_functions(){
  69. # Functions are defined in fn_functions.
  70. functionfile="${FUNCNAME}"
  71. fn_runfunction
  72. }
  73. fn_functions
  74. getopt=$1
  75. fn_getopt