sdtdserver 2.7 KB

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