sdtdserver 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #!/bin/bash
  2. # 7 Days To Die
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Website: http://danielgibbs.co.uk
  6. # Version: 210115
  7. #### Variables ####
  8. # Notification Email
  9. # (on|off)
  10. emailnotification="off"
  11. email="email@example.com"
  12. # Steam login
  13. steamuser="username" # 7 Days requires a registered user for downloads
  14. steampass="password" # enter your password
  15. # Start Variables
  16. ip="0.0.0.0" # can leave to answer on any IP
  17. # Telnet Variables - used for graceful shutdown
  18. telnetip="127.0.0.1" # if 127.0.0.1 doesn't work, enter your public IP
  19. telnetport="8081" # change to your customized port number
  20. telnetpass="password" # set for your telnet password
  21. # Mod Variables
  22. # If you are using or want to use Alloc's Server Fixes,
  23. # uncomment the variable below
  24. # *****Note: It has happened where the core gets updated, but
  25. # Alloc's fixes weren't updated yet. If this happens
  26. # you may need to comment out or set to false temporarily
  27. # until Alloc's patch is updated. Please see 7 Days To Die
  28. # forum for details. Many people use this patch.
  29. allocsfixes=true # set to true if you want installed, false or comment if not
  30. # http://7daystodie.gamepedia.com/Server
  31. fn_parms(){
  32. parms="-configfile=\"${servercfgfullpath}\" -dedicated"
  33. }
  34. #### Advanced Variables ####
  35. # Steam
  36. appid="294420"
  37. # Server Details
  38. servicename="sdtd-server"
  39. gamename="7 Days To Die"
  40. engine="unity3d"
  41. # Directories
  42. rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  43. selfname="$(basename $0)"
  44. lockselfname=".${servicename}.lock"
  45. filesdir="${rootdir}/serverfiles"
  46. systemdir="${filesdir}"
  47. executabledir="${filesdir}"
  48. executable="./7DaysToDie.sh"
  49. servercfgdir="${filesdir}"
  50. servercfg="${servicename}.xml"
  51. servercfgfullpath="${servercfgdir}/${servercfg}"
  52. defaultcfg="${filesdir}/serverconfig.xml"
  53. backupdir="${rootdir}/backups"
  54. # Logging
  55. logdays="7"
  56. gamelogdir="${rootdir}/log/server"
  57. scriptlogdir="${rootdir}/log/script"
  58. consolelogdir="${rootdir}/log/console"
  59. gamelog="${gamelogdir}/${servicename}-game.log"
  60. scriptlog="${scriptlogdir}/${servicename}-script.log"
  61. consolelog="${consolelogdir}/${servicename}-console.log"
  62. emaillog="${scriptlogdir}/${servicename}-email.log"
  63. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  64. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  65. ##### Script #####
  66. # Do not edit
  67. fn_runfunction(){
  68. # Functions are downloaded and run with this function
  69. if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
  70. cd "${rootdir}"
  71. if [ ! -d "functions" ]; then
  72. mkdir functions
  73. fi
  74. cd functions
  75. echo -e "loading ${functionfile}...\c"
  76. wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/functions/${functionfile} 2>&1 | grep -F HTTP | cut -c45-
  77. chmod +x "${functionfile}"
  78. cd "${rootdir}"
  79. sleep 1
  80. fi
  81. source "${rootdir}/functions/${functionfile}"
  82. }
  83. fn_functions(){
  84. # Functions are defined in fn_functions.
  85. functionfile="${FUNCNAME}"
  86. fn_runfunction
  87. }
  88. fn_functions
  89. getopt=$1
  90. fn_getopt