roserver 3.3 KB

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