terrariaserver 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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="070915"
  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="-config ${servercfgfullpath}"
  21. }
  22. #### Advanced Variables ####
  23. # Steam
  24. appid="105600"
  25. # Server Details
  26. servicename="terraria-server"
  27. gamename="Terraria"
  28. engine="terraria"
  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="./TerrariaServer"
  37. servercfg="${servicename}.txt"
  38. servercfgdir="${filesdir}"
  39. servercfgfullpath="${servercfgdir}/${servercfg}"
  40. servercfgdefault="${servercfgdir}/lgsm-default.txt"
  41. backupdir="${rootdir}/backups"
  42. # Logging
  43. logdays="7"
  44. #gamelogdir="" # Terraria Doesn't Have a Server Log
  45. scriptlogdir="${rootdir}/log/script"
  46. consolelogdir="${rootdir}/log/console"
  47. scriptlog="${scriptlogdir}/${servicename}-script.log"
  48. consolelog="${consolelogdir}/${servicename}-console.log"
  49. emaillog="${scriptlogdir}/${servicename}-email.log"
  50. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  51. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  52. ##### Script #####
  53. # Do not edit
  54. fn_runfunction(){
  55. # Functions are downloaded and run with this function
  56. if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
  57. cd "${rootdir}"
  58. if [ ! -d "functions" ]; then
  59. mkdir functions
  60. fi
  61. cd functions
  62. echo -e " loading ${functionfile}...\c"
  63. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/functions/${functionfile} 2>&1 | grep -F HTTP | cut -c45-
  64. chmod +x "${functionfile}"
  65. cd "${rootdir}"
  66. fi
  67. source "${rootdir}/functions/${functionfile}"
  68. }
  69. fn_functions(){
  70. # Functions are defined in fn_functions.
  71. functionfile="${FUNCNAME}"
  72. fn_runfunction
  73. }
  74. fn_functions
  75. getopt=$1
  76. fn_getopt