pzserver 2.1 KB

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