pzserver 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/bin/bash
  2. # Project Zomboid
  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="anonymous"
  14. steampass=""
  15. # Start Variables
  16. ip="0.0.0.0"
  17. updateonstart="no"
  18. fn_parms(){
  19. parms=""
  20. }
  21. #### Advanced Variables ####
  22. # Steam
  23. appid="108600"
  24. # Server Details
  25. servicename="pz-server"
  26. gamename="Project Zomboid"
  27. engine="projectzomboid"
  28. # Directories
  29. rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  30. selfname="$(basename $0)"
  31. lockselfname=".${servicename}.lock"
  32. filesdir="${rootdir}/serverfiles"
  33. systemdir="${filesdir}/projectzomboid"
  34. executabledir="${filesdir}"
  35. executable="./projectzomboid-dedi-server.sh"
  36. servercfgdir="${rootdir}/Zomboid/Server"
  37. servercfg="servertest.ini"
  38. servercfgfullpath="${servercfgdir}/${servercfg}"
  39. defaultcfg="${servercfgdir}/servertest.ini"
  40. backupdir="${rootdir}/backups"
  41. # Logging
  42. logdays="7"
  43. gamelogdir="${HOME}/Zomboid/Logs"
  44. scriptlogdir="${rootdir}/log/script"
  45. consolelogdir="${rootdir}/log/console"
  46. scriptlog="${scriptlogdir}/${servicename}-script.log"
  47. consolelog="${consolelogdir}/${servicename}-console.log"
  48. emaillog="${scriptlogdir}/${servicename}-email.log"
  49. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  50. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  51. ##### Script #####
  52. # Do not edit
  53. fn_runfunction(){
  54. # Functions are downloaded and run with this function
  55. if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
  56. cd "${rootdir}"
  57. if [ ! -d "functions" ]; then
  58. mkdir functions
  59. fi
  60. cd functions
  61. echo -e "loading ${functionfile}...\c"
  62. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/functions/${functionfile} 2>&1 | grep -F HTTP | cut -c45-
  63. chmod +x "${functionfile}"
  64. cd "${rootdir}"
  65. sleep 1
  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