sdtdserver 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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"
  17. # http://7daystodie.gamepedia.com/Server
  18. fn_parms(){
  19. parms="-configfile=\"${servercfgfullpath}\" -dedicated"
  20. }
  21. # Logging
  22. # Number of days to keep script logs
  23. logdays="7"
  24. #### Advanced Variables ####
  25. # Steam
  26. appid="294420"
  27. # Server Details
  28. servicename="sdtd-server"
  29. gamename="7 Days To Die"
  30. engine="unity3d"
  31. # Directories
  32. rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  33. selfname="$(basename $0)"
  34. lockselfname=".${servicename}.lock"
  35. filesdir="${rootdir}/serverfiles"
  36. systemdir="${filesdir}"
  37. executabledir="${filesdir}"
  38. executable="./7DaysToDie.sh"
  39. servercfgdir="${filesdir}"
  40. servercfg="${servicename}.xml"
  41. servercfgfullpath="${servercfgdir}/${servercfg}"
  42. defaultcfg="${filesdir}/serverconfig.xml"
  43. backupdir="${rootdir}/backups"
  44. # Logging
  45. gamelogdir="${rootdir}/log/server"
  46. scriptlogdir="${rootdir}/log/script"
  47. consolelogdir="${rootdir}/log/console"
  48. gamelog="${gamelogdir}/${servicename}-game.log"
  49. scriptlog="${scriptlogdir}/${servicename}-script.log"
  50. consolelog="${consolelogdir}/${servicename}-console.log"
  51. emaillog="${scriptlogdir}/${servicename}-email.log"
  52. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  53. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  54. ##### Script #####
  55. # Do not edit
  56. fn_runfunction(){
  57. # Functions are downloaded and run with this function
  58. if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
  59. cd "${rootdir}"
  60. if [ ! -d "functions" ]; then
  61. mkdir functions
  62. fi
  63. cd functions
  64. echo -e "loading ${functionfile}...\c"
  65. wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/functions/${functionfile} 2>&1 | grep -F HTTP | cut -c45-
  66. chmod +x "${functionfile}"
  67. cd "${rootdir}"
  68. sleep 1
  69. fi
  70. source "${rootdir}/functions/${functionfile}"
  71. }
  72. fn_functions(){
  73. # Functions are defined in fn_functions.
  74. functionfile="${FUNCNAME}"
  75. fn_runfunction
  76. }
  77. fn_functions
  78. getopt=$1
  79. fn_getopt