ut3server 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. #!/bin/bash
  2. # Unreal Tournament 3
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Website: https://gameservermanagers.com
  6. if [ -f ".dev-debug" ]; then
  7. exec 5>dev-debug.log
  8. BASH_XTRACEFD="5"
  9. set -x
  10. fi
  11. version="210516"
  12. #### Variables ####
  13. # Notification Alerts
  14. # (on|off)
  15. # Email
  16. emailalert="off"
  17. email="email@example.com"
  18. # Pushbullet
  19. # https://www.pushbullet.com/#settings
  20. pushbulletalert="off"
  21. pushbullettoken="accesstoken"
  22. # Start Variables
  23. ip="0.0.0.0"
  24. port="7777"
  25. queryport="25300"
  26. defaultmap="VCTF-Suspense"
  27. game="UTGameContent.UTVehicleCTFGame_Content"
  28. mutators="" #"UTGame.UTMutator_Instagib,UTGame.UTMutator_LowGrav"
  29. isdedicated="true"
  30. islanmatch="false"
  31. usesstats="false"
  32. shouldadvertise="true"
  33. pureserver="1"
  34. allowjoininprogress="true"
  35. maxplayers="32"
  36. #list of game types and mutators : http://wiki.unrealadmin.org/FAQ:UT3
  37. fn_parms(){
  38. parms="server ${defaultmap}?Game=${game}?bIsDedicated=${isdedicated}?bIsLanMatch=${islanmatch}?bUsesStats=${usesstats}?bShouldAdvertise=${shouldadvertise}?PureServer=${pureserver}?bAllowJoinInProgress=${allowjoininprogress}?MaxPlayers=${maxplayers}?Mutator=${mutators} -port=${port} -queryport=${queryport} -multihome=${ip} -nohomedir -unattended -log=${gamelog}"
  39. }
  40. # Server Details
  41. servicename="ut3-server"
  42. gamename="Unreal Tournament 3"
  43. engine="unreal3"
  44. # Directories
  45. rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
  46. selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  47. lockselfname=".${servicename}.lock"
  48. lgsmdir="${rootdir}/lgsm"
  49. functionsdir="${lgsmdir}/functions"
  50. libdir="${lgsmdir}/lib"
  51. filesdir="${rootdir}/serverfiles"
  52. systemdir="${filesdir}"
  53. executabledir="${systemdir}/Binaries"
  54. executable="./ut3"
  55. servercfg="UTGame.ini"
  56. servercfgdir="${systemdir}/UTGame/Config"
  57. servercfgfullpath="${servercfgdir}/${servercfg}"
  58. backupdir="${rootdir}/backups"
  59. # Logging
  60. logdays="7"
  61. gamelogdir="${rootdir}/log/server"
  62. scriptlogdir="${rootdir}/log/script"
  63. consolelogdir="${rootdir}/log/console"
  64. consolelogging="on"
  65. gamelog="${gamelogdir}/${servicename}-game.log"
  66. scriptlog="${scriptlogdir}/${servicename}-script.log"
  67. consolelog="${consolelogdir}/${servicename}-console.log"
  68. emaillog="${scriptlogdir}/${servicename}-email.log"
  69. gamelogdate="${gamelogdir}/${servicename}-game-$(date '+%d-%m-%Y-%H-%M-%S').log"
  70. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  71. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  72. # Github Branch Select
  73. # Allows for the use of different function files
  74. # from a different repo and/or branch.
  75. githubuser="GameServerManagers"
  76. githubrepo="LinuxGSM"
  77. githubbranch="master"
  78. ##### Script #####
  79. # Do not edit
  80. # Fetches core_dl for file downloads
  81. fn_fetch_core_dl(){
  82. github_file_url_dir="lgsm/functions"
  83. github_file_url_name="${functionfile}"
  84. filedir="${functionsdir}"
  85. filename="${github_file_url_name}"
  86. githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
  87. # If the file is missing, then download
  88. if [ ! -f "${filedir}/${filename}" ]; then
  89. if [ ! -d "${filedir}" ]; then
  90. mkdir -p "${filedir}"
  91. fi
  92. echo -e " fetching ${filename}...\c"
  93. # Check curl exists and use available path
  94. curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
  95. for curlcmd in ${curlpaths}
  96. do
  97. if [ -x "${curlcmd}" ]; then
  98. break
  99. fi
  100. done
  101. # If curl exists download file
  102. if [ "$(basename ${curlcmd})" == "curl" ]; then
  103. curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
  104. if [ $? -ne 0 ]; then
  105. echo -e "\e[0;31mFAIL\e[0m\n"
  106. echo "${curlfetch}"
  107. echo -e "${githuburl}\n"
  108. exit 1
  109. else
  110. echo -e "\e[0;32mOK\e[0m"
  111. fi
  112. else
  113. echo -e "\e[0;31mFAIL\e[0m\n"
  114. echo "Curl is not installed!"
  115. echo -e ""
  116. exit 1
  117. fi
  118. chmod +x "${filedir}/${filename}"
  119. fi
  120. source "${filedir}/${filename}"
  121. }
  122. core_dl.sh(){
  123. # Functions are defined in core_functions.sh.
  124. functionfile="${FUNCNAME}"
  125. fn_fetch_core_dl
  126. }
  127. core_functions.sh(){
  128. # Functions are defined in core_functions.sh.
  129. functionfile="${FUNCNAME}"
  130. fn_fetch_core_dl
  131. }
  132. core_dl.sh
  133. core_functions.sh
  134. getopt=$1
  135. core_getopt.sh