#!/bin/bash

######################################################
# 
# Launch Wolfenstein Enemy Territory server
# MUST be launched with systemctl (work as a service)
# helped by the `serverctl` script
#
#####################################################

ET_BASE=/usr/local/games/enemy-territory
ET_HOME=/opt/games/enemy-territory/server
ET_IP=
ET_PORT=27960
ET_INSTANCE=

SERVER_BASENAME=etded.x86

LOGFILE=${ET_HOME}/logs/et_server_$(date +"%Y-%m-%d_%H-%M-%S").log

        $ET_BASE/$SERVER_BASENAME \
        \
                +set com_hunkmegs   "128" \
                +set com_zonemegs   "48" \
                +set dedicated      "2" \
                +set fs_basepath    "$ET_BASE" \
                +set fs_game        "jaymod" \
                +set fs_homepath    "$ET_HOME" \
                +set net_ip         "$ET_IP" \
                +set net_port       "$ET_PORT" \
                +set omnibot_enable "1" \
                +set sv_punkbuster  "1" \
                +set ttycon         "0" \
                +set xx_instance    "$ET_INSTANCE" \
        \
                +exec "server.cfg" \
        > $LOGFILE 2>&1