sdtdserver 2.6 KB

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