4
0

ut99server 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #!/bin/bash
  2. # Unreal Tournament 99
  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. # Directories
  13. rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  14. selfname="$0"
  15. lockselfname=$(echo ".${servicename}.lock")
  16. filesdir="${rootdir}/serverfiles"
  17. systemdir="${filesdir}/System"
  18. executabledir="${systemdir}"
  19. executable="./ucc-bin"
  20. compressedmapsdir="${rootdir}/Maps-Compressed"
  21. defaultcfg="${systemdir}/Default.ini"
  22. backupdir="backups"
  23. # Server Details
  24. servicename="ut99-server"
  25. gamename="Unreal Tournament 99"
  26. engine="unreal"
  27. ini="${servicename}.ini"
  28. servername=$(grep -s ServerName= ${systemdir}/${ini}|sed 's/ServerName=//g')
  29. ip="0.0.0.0"
  30. # Logging
  31. logdays="7"
  32. scriptlogdir="${rootdir}/log/script"
  33. consolelogdir="${rootdir}/log/console"
  34. scriptlog="${scriptlogdir}/${servicename}-script.log"
  35. consolelog="${consolelogdir}/${servicename}-console.log"
  36. emaillog="${scriptlogdir}/${servicename}-email.log"
  37. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  38. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  39. # Start Variables
  40. fn_parms(){
  41. defaultmap="DM-Deck16]["
  42. parms="server ${defaultmap}.unr ini=${systemdir}/${ini}"
  43. }
  44. ##### Script #####
  45. # Do not edit
  46. fn_install(){
  47. fn_rootcheck
  48. fn_header
  49. if [ -z "${autoinstall}" ]; then
  50. fn_serverdirectory
  51. fn_header
  52. fi
  53. fn_ut99filesdl
  54. fn_ut99install
  55. fn_loginstall
  56. fn_getquery
  57. fn_serverconfig
  58. fn_ut99fix
  59. fn_header
  60. fn_details
  61. fn_installcomplete
  62. }
  63. fn_functions(){
  64. # Functions are defines in fn_functions.
  65. functionfile="${FUNCNAME}"
  66. fn_runfunction
  67. }
  68. fn_runfunction(){
  69. # Functions are downloaded and run with this function
  70. if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
  71. cd "${rootdir}"
  72. if [ ! -d "functions" ]; then
  73. mkdir functions
  74. fi
  75. cd functions
  76. echo -e "loading ${functionfile}...\c"
  77. wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/functions/${functionfile} 2>&1 | grep -F HTTP | cut -c45-
  78. chmod +x "${functionfile}"
  79. cd "${rootdir}"
  80. sleep 1
  81. fi
  82. source "${rootdir}/functions/${functionfile}"
  83. }
  84. fn_functions
  85. case "$1" in
  86. start)
  87. fn_startserver;;
  88. stop)
  89. fn_stopserver;;
  90. restart)
  91. fn_restartserver;;
  92. monitor)
  93. fn_monitorserver;;
  94. email-test)
  95. fn_emailtest;;
  96. details)
  97. fn_details;;
  98. backup)
  99. fn_backupserver;;
  100. console)
  101. fn_console;;
  102. debug)
  103. fn_debugserver;;
  104. install)
  105. fn_install;;
  106. map-compressor)
  107. fn_ut99compressmaps;;
  108. *)
  109. echo "Usage: $0 {start|stop|restart|monitor|email-test|details|backup|console|debug|install|map-compressor}"
  110. exit 1;;
  111. esac
  112. exit