| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- #!/bin/bash
- # Unreal Tournament 99
- # Server Management Script
- # Author: Daniel Gibbs
- # Website: http://danielgibbs.co.uk
- # Version: 010115
- #### Variables ####
- # Notification Email
- # (on|off)
- emailnotification="off"
- email="email@example.com"
- # Directories
- rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
- selfname="$0"
- lockselfname=$(echo ".${servicename}.lock")
- filesdir="${rootdir}/serverfiles"
- systemdir="${filesdir}/System"
- executabledir="${systemdir}"
- executable="./ucc-bin"
- compressedmapsdir="${rootdir}/Maps-Compressed"
- defaultcfg="${systemdir}/Default.ini"
- backupdir="backups"
- # Server Details
- servicename="ut99-server"
- gamename="Unreal Tournament 99"
- engine="unreal"
- ini="${servicename}.ini"
- servername=$(grep -s ServerName= ${systemdir}/${ini}|sed 's/ServerName=//g')
- ip="0.0.0.0"
- # Logging
- logdays="7"
- scriptlogdir="${rootdir}/log/script"
- consolelogdir="${rootdir}/log/console"
- scriptlog="${scriptlogdir}/${servicename}-script.log"
- consolelog="${consolelogdir}/${servicename}-console.log"
- emaillog="${scriptlogdir}/${servicename}-email.log"
- scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
- consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
- # Start Variables
- fn_parms(){
- defaultmap="DM-Deck16]["
- parms="server ${defaultmap}.unr ini=${systemdir}/${ini}"
- }
- ##### Script #####
- # Do not edit
- fn_install(){
- fn_rootcheck
- fn_header
- if [ -z "${autoinstall}" ]; then
- fn_serverdirectory
- fn_header
- fi
- fn_ut99filesdl
- fn_ut99install
- fn_loginstall
- fn_getquery
- fn_serverconfig
- fn_ut99fix
- fn_header
- fn_details
- fn_installcomplete
- }
- fn_functions(){
- # Functions are defines in fn_functions.
- functionfile="${FUNCNAME}"
- fn_runfunction
- }
- fn_runfunction(){
- # Functions are downloaded and run with this function
- if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
- cd "${rootdir}"
- if [ ! -d "functions" ]; then
- mkdir functions
- fi
- cd functions
- echo -e "loading ${functionfile}...\c"
- wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/functions/${functionfile} 2>&1 | grep -F HTTP | cut -c45-
- chmod +x "${functionfile}"
- cd "${rootdir}"
- sleep 1
- fi
- source "${rootdir}/functions/${functionfile}"
- }
- fn_functions
- case "$1" in
- start)
- fn_startserver;;
- stop)
- fn_stopserver;;
- restart)
- fn_restartserver;;
- monitor)
- fn_monitorserver;;
- email-test)
- fn_emailtest;;
- details)
- fn_details;;
- backup)
- fn_backupserver;;
- console)
- fn_console;;
- debug)
- fn_debugserver;;
- install)
- fn_install;;
- map-compressor)
- fn_ut99compressmaps;;
- *)
- echo "Usage: $0 {start|stop|restart|monitor|email-test|details|backup|console|debug|install|map-compressor}"
- exit 1;;
- esac
- exit
|