4
0

ut99server 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #!/bin/bash
  2. # Unreal Tournament 99
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Website: http://gameservermanagers.com
  6. version="121215"
  7. #### Variables ####
  8. # Notification Email
  9. # (on|off)
  10. emailnotification="off"
  11. email="email@example.com"
  12. # Start Variables
  13. defaultmap="DM-Deck16]["
  14. ip="0.0.0.0"
  15. fn_parms(){
  16. parms="server ${defaultmap}.unr ini=${servercfgfullpath}"
  17. }
  18. #### Advanced Variables ####
  19. # Server Details
  20. servicename="ut99-server"
  21. gamename="Unreal Tournament 99"
  22. engine="unreal"
  23. # Directories
  24. rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
  25. selfname=$(basename $(readlink -f "${BASH_SOURCE[0]}"))
  26. lockselfname=".${servicename}.lock"
  27. filesdir="${rootdir}/serverfiles"
  28. systemdir="${filesdir}/System"
  29. executabledir="${systemdir}"
  30. executable="./ucc-bin"
  31. servercfg="${servicename}.ini"
  32. servercfgdir="${systemdir}"
  33. servercfgfullpath="${servercfgdir}/${servercfg}"
  34. servercfgdefault="${servercfgdir}/Default.ini"
  35. compressedmapsdir="${rootdir}/Maps-Compressed"
  36. backupdir="${rootdir}/backups"
  37. # Logging
  38. logdays="7"
  39. scriptlogdir="${rootdir}/log/script"
  40. consolelogdir="${rootdir}/log/console"
  41. scriptlog="${scriptlogdir}/${servicename}-script.log"
  42. consolelog="${consolelogdir}/${servicename}-console.log"
  43. emaillog="${scriptlogdir}/${servicename}-email.log"
  44. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  45. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  46. # Github Branch Select
  47. # Allows for the use of different function files
  48. # from a different repo and/or branch.
  49. githubuser="dgibbs64"
  50. githubrepo="linuxgsm"
  51. githubbranch="master"
  52. ##### Script #####
  53. # Do not edit
  54. fn_getgithubfile(){
  55. filename=$1
  56. exec=$2
  57. fileurl=${3:-$filename}
  58. filepath="${rootdir}/${filename}"
  59. filedir=$(dirname "${filepath}")
  60. # If the function file is missing, then download
  61. if [ ! -f "${filepath}" ]; then
  62. if [ ! -d "${filedir}" ]; then
  63. mkdir "${filedir}"
  64. fi
  65. githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}"
  66. echo -e " fetching ${filename}...\c"
  67. if [ "$(command -v curl)" ]||[ "$(which curl >/dev/null 2>&1)" ]||[ -f "/usr/bin/curl" ]||[ -f "/bin/curl" ]; then
  68. :
  69. else
  70. echo -e "\e[0;31mFAIL\e[0m\n"
  71. echo "Curl is not installed!"
  72. echo -e ""
  73. exit
  74. fi
  75. curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1)
  76. if [ $? -ne 0 ]; then
  77. echo -e "\e[0;31mFAIL\e[0m\n"
  78. echo " ${curl}"|grep "curl:"
  79. echo -e "${githuburl}\n"
  80. exit
  81. else
  82. echo -e "\e[0;32mOK\e[0m"
  83. fi
  84. if [ "${exec}" ]; then
  85. chmod +x "${filepath}"
  86. fi
  87. fi
  88. if [ "${exec}" ]; then
  89. source "${filepath}"
  90. fi
  91. }
  92. fn_runfunction(){
  93. fn_getgithubfile "functions/${functionfile}" 1
  94. }
  95. fn_functions(){
  96. # Functions are defined in fn_functions.
  97. functionfile="${FUNCNAME}"
  98. fn_runfunction
  99. }
  100. fn_functions
  101. getopt=$1
  102. fn_getopt