kfserver 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. #!/bin/bash
  2. # Killing Floor
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Website: http://danielgibbs.co.uk
  6. # Version: 010115
  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. fn_parms(){
  17. defaultmap="KF-BioticsLab.rom"
  18. parms="server ${defaultmap}?game=KFmod.KFGameType?VACSecured=true -nohomedir ini=${ini} log=${gamelog}"
  19. # Start Variables for Objective mode
  20. #defaultmap="KFO-Steamland"
  21. #parms="server ${defaultmap}?Game=KFStoryGame.KFStoryGame?VACSecured=true -nohomedir ini=${ini} log=${gamelog}"
  22. }
  23. #### Advanced Variables ####
  24. # Steam
  25. appid="215360"
  26. # Directories
  27. rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  28. selfname="$0"
  29. lockselfname=$(echo ".${servicename}.lock")
  30. filesdir="${rootdir}/serverfiles"
  31. systemdir="${filesdir}/System"
  32. executabledir="${systemdir}"
  33. executable="./ucc-bin"
  34. compressedmapsdir="${rootdir}/Maps-Compressed"
  35. defaultcfg="${systemdir}/Default.ini"
  36. backupdir="backups"
  37. # Server Details
  38. servicename="kf-server"
  39. gamename="Killing Floor"
  40. engine="unreal2"
  41. ini="${servicename}.ini"
  42. servername=$(grep -s ServerName= ${systemdir}/${ini}|sed 's/ServerName=//g')
  43. ip="0.0.0.0"
  44. # Logging
  45. logdays="7"
  46. gamelogdir="${rootdir}/log/server"
  47. scriptlogdir="${rootdir}/log/script"
  48. consolelogdir="${rootdir}/log/console"
  49. gamelog="${gamelogdir}/${servicename}-game.log"
  50. scriptlog="${scriptlogdir}/${servicename}-script.log"
  51. consolelog="${consolelogdir}/${servicename}-console.log"
  52. emaillog="${scriptlogdir}/${servicename}-email.log"
  53. gamelogdate="${gamelogdir}/${servicename}-game-$(date '+%d-%m-%Y-%H-%M-%S').log"
  54. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  55. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  56. ##### Script #####
  57. # Do not edit
  58. fn_install(){
  59. fn_rootcheck
  60. fn_header
  61. if [ -z "${autoinstall}" ]; then
  62. fn_serverdirectory
  63. fn_header
  64. fi
  65. fn_steamdl
  66. fn_steaminstall
  67. fn_steamfix
  68. fn_loginstall
  69. fn_getquery
  70. fn_serverconfig
  71. fn_kffix
  72. fn_header
  73. fn_details
  74. fn_installcomplete
  75. }
  76. fn_functions(){
  77. # Functions are defines in fn_functions.
  78. functionfile="${FUNCNAME}"
  79. fn_runfunction
  80. }
  81. fn_runfunction(){
  82. # Functions are downloaded and run with this function
  83. if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
  84. cd "${rootdir}"
  85. if [ ! -d "functions" ]; then
  86. mkdir functions
  87. fi
  88. cd functions
  89. echo -e "loading ${functionfile}...\c"
  90. wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/functions/${functionfile} 2>&1 | grep -F HTTP | cut -c45-
  91. chmod +x "${functionfile}"
  92. cd "${rootdir}"
  93. sleep 1
  94. fi
  95. source "${rootdir}/functions/${functionfile}"
  96. }
  97. fn_functions
  98. case "$1" in
  99. start)
  100. fn_startserver;;
  101. stop)
  102. fn_stopserver;;
  103. restart)
  104. fn_restartserver;;
  105. update)
  106. norestart=1;
  107. fn_versioncheck;;
  108. update-restart)
  109. fn_versioncheck;;
  110. validate)
  111. fn_validateserver;;
  112. validate-restart)
  113. fn_stopserver
  114. fn_validateserver
  115. fn_startserver;;
  116. monitor)
  117. fn_monitorserver;;
  118. email-test)
  119. fn_emailtest;;
  120. details)
  121. fn_details;;
  122. backup)
  123. fn_backupserver;;
  124. console)
  125. fn_console;;
  126. debug)
  127. fn_debugserver;;
  128. install)
  129. fn_install;;
  130. auto-install)
  131. fn_autoinstall;;
  132. map-compressor)
  133. fn_unreal2compressmaps;;
  134. *)
  135. echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install|map-compressor}"
  136. exit 1;;
  137. esac
  138. exit