Browse Source

Updated the installer for kfserver and ut2k4server

-Removed charset fix as it appears to not be needed anymore (I can
re-add this if this is not the case.
-Tidied up the installer
- added serverquery.py function - ut2k4server
- modified fn_syscheck - ut2k4server
- moved Notification email to the top in line with other scripts -
ut2k4server
pull/8/merge
Daniel Gibbs 12 years ago
parent
commit
4a6f70badf
  1. 53
      KillingFloor/kfserver
  2. 71
      UnrealTournament2004/ut2k4server

53
KillingFloor/kfserver

@ -1,12 +1,17 @@
#!/bin/bash
# Killing Floor
# Killing Floor
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010813
# Version: 180813
#### Variables ####
# Notification Email
# (on|off)
emailnotification="off"
email="[email protected]"
# Steam login
steamuser="username"
steampass="password"
@ -14,11 +19,6 @@ steampass="password"
# Steam
appid="215360"
# Notification Email
# (on|off)
emailnotification="off"
email="[email protected]"
# Directorys
rootdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
selfname="$0"
@ -79,7 +79,7 @@ if [ -f serverquery.py ];then
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Monitor detected ${servername} has locked up!" >> ${logfile}
sleep 1
fn_restartserver
else
else
echo -e "[\e[0;32m OK \e[0;39m] Querying ${servicename}: ${servername}: ${serverquery}"
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Querying ${servername}: ${serverquery}" >> ${logfile}
sleep 1
@ -168,7 +168,7 @@ if [ "${emailnotification}" = "on" ];then
failurereason="Testing ${servicename} email notification"
actiontaken="Sent test email...hello is this thing on?"
fn_emailnotification
else
else
echo -e "[\e[0;31m FAIL \e[0;39m] Email notificaion not enabled"
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Email notificaion not enabled" >> ${logfile}
fi
@ -279,7 +279,7 @@ else
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Monitor detected ${servername} is currently checking for updates!" >> ${logfile}
echo -e "[\e[0;36m INFO \e[0;39m] ${servicename}: ${servername} will start when updating is complete"
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} will start when updating is complete" >> ${logfile}
fi
fi
}
fn_updateserver(){
@ -324,7 +324,7 @@ mkdir $compressedmapsdir
rm -rfv ${filesdir}/Maps/*.uz2
cd ${systemdir}
./ucc-bin compress ../Maps/* --nohomedir
mv -fv ${filesdir}/Maps/*.uz2 $compressedmapsdir
mv -fv ${filesdir}/Maps/*.uz2 $compressedmapsdir
}
fn_steamguard(){
@ -383,7 +383,7 @@ cd ${rootdir}
mkdir steamcmd
cd steamcmd
if [ ! -f steam.sh ];then
wget http://media.steampowered.com/client/steamcmd_linux.tar.gz
wget http://media.steampowered.com/client/steamcmd_linux.tar.gz
tar --verbose -zxf steamcmd_linux.tar.gz
rm -v steamcmd_linux.tar.gz
chmod +x steam.sh
@ -424,7 +424,7 @@ echo "Install Directory:"
pwd
echo ""
while true; do
read -p "Continue [y/N]" yn
read -p "Continue [y/N]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) echo Exiting; return 1 ;;
@ -438,7 +438,6 @@ echo "Installing ${gamename} Server"
echo "================================="
cd ${rootdir}/steamcmd
mkdir -v ${filesdir}
mkdir -v ${logdir}
touch install.txt
chmod 0600 install.txt
echo "login ${steamuser} ${steampass}" > install.txt
@ -460,34 +459,34 @@ echo "================================="
echo ""
echo "Configuring ${gamename} Server"
echo "================================="
sleep 1
echo "Copying ${systemdir}/default.ini to ${systemdir}/${ini}"
cp ${systemdir}/Default.ini ${systemdir}/${ini}
sleep 1
echo ""
echo "Applying WebAdmin CharSet fix!"
echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1"
echo "Creating log directory"
mkdir -v ${logdir}
sleep 1
echo ""
echo "Applying WebAdmin ROOst.css fix!"
echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
sed -i 's/none}/none;/g' ${filesdir}/Web/ServerAdmin/ROOst.css
sed -i 's/underline}/underline;/g' ${filesdir}/Web/ServerAdmin/ROOst.css
sleep 1
echo ""
echo "Setting WebAdmin username and password"
sleep 1
echo ""
echo "Enabling Web Interface"
sleep 2
sed -i 's/CharSet="iso-8859-1"/CharSet="utf-8"/g' ${systemdir}/UWeb.int
sed -i 's/none}/none;/g' ${filesdir}/Web/ServerAdmin/ROOst.css
sed -i 's/underline}/underline;/g' ${filesdir}/Web/ServerAdmin/ROOst.css
sed -i 's/AdminName=/AdminName=admin/g' ${systemdir}/${ini}
sed -i 's/AdminPassword=/AdminPassword=kfpass/g' ${systemdir}/${ini}
sleep 1
echo ""
echo "Enabling WebAdmin"
sed -i 's/bEnabled=False/bEnabled=True/g' ${systemdir}/${ini}
mkdir ${logdir}
cd ${rootdir}
sleep 1
echo ""
cd ${rootdir}
echo "Default Settings"
echo "=============================="
sleep 1
echo "WebAdmin Details:"
echo "Url: http://localhost:8075"
echo "Username: admin"
@ -526,10 +525,10 @@ case "$1" in
debug)
fn_debugserver;;
map-compressor)
fn_compressmaps;;
fn_compressmaps;;
steam-auth)
fn_updateserver
fn_steamguard;;
fn_steamguard;;
email-test)
fn_emailtest;;
*)

71
UnrealTournament2004/ut2k4server

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 110813
# Version: 180813
#### Variables ####
@ -48,16 +48,43 @@ fi
}
fn_syscheck(){
if [ ! -e ${filesdir} ];then
echo -e "[\e[0;31m FAIL \e[0;39m] Cannot access ${filesdir}: No such directory"
if [ ! -e ${systemdir} ];then
echo -e "[\e[0;31m FAIL \e[0;39m] Cannot access ${systemdir}: No such directory"
exit
fi
}
fn_serverquery(){
# uses serverquery.py to directly query the server
# detects if the server locks up
if [ -f serverquery.py ];then
echo -e "[\e[0;36m INFO \e[0;39m] serverquery.py detected"
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: serverquery.py detected" >> ${logfile}
echo -e "[\e[0;32m OK \e[0;39m] Querying ${servicename}: ${servername}: QUERYING"
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Querying ${servername}: QUERYING" >> ${logfile}
serverquery=`./serverquery.py 127.0.0.1 ${port} 2>&1`
sleep 1
if [ "${serverquery}" = "ERROR 1" ]||[ "${serverquery}" = "ERROR 2" ]||[ "${serverquery}" = "ERROR 3" ];then
echo -e "[\e[0;31m FAIL \e[0;39m] Querying ${servicename}: ${servername}: ${serverquery}"
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Querying ${servername}: ${serverquery}" >> ${logfile}
sleep 1
echo -e "[\e[1;33m WARN \e[0;39m] ${servicename}: Monitor detected ${servername} has locked up!"
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Monitor detected ${servername} has locked up!" >> ${logfile}
sleep 1
fn_restartserver
else
echo -e "[\e[0;32m OK \e[0;39m] Querying ${servicename}: ${servername}: ${serverquery}"
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Querying ${servername}: ${serverquery}" >> ${logfile}
sleep 1
fi
fi
}
fn_runcheck(){
# already running check
pidwc=`screen -ls |grep ${servicename} |awk -F . '{print $1}'|awk '{print $1}'|wc -l`
if [ ${pidwc} -eq 1 ];then
fn_serverquery
echo -e "[\e[0;36m INFO \e[0;39m] ${servicename}: ${servername} is already running"
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already running" >> ${logfile}
exit
@ -134,7 +161,7 @@ if [ "${emailnotification}" = "on" ];then
failurereason="Testing ${servicename} email notification"
actiontaken="Sent test email...hello is this thing on?"
fn_emailnotification
else
else
echo -e "[\e[0;31m FAIL \e[0;39m] Email notificaion not enabled"
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Email notificaion not enabled" >> ${logfile}
fi
@ -273,7 +300,7 @@ mkdir $compressedmapsdir
rm -rfv ${filesdir}/Maps/*.uz2
cd ${systemdir}
./ucc-bin compress ../Maps/* --nohomedir
mv -fv ${filesdir}/Maps/*.uz2 $compressedmapsdir
mv -fv ${filesdir}/Maps/*.uz2 $compressedmapsdir
}
#
@ -335,7 +362,7 @@ done
fn_install(){
fn_rootcheck
fn_header
if [ -d ${filesdir} ];then
if [ -d ${systemdir} ];then
echo "${gamename} Server is already installed here:"
pwd
echo ""
@ -353,7 +380,7 @@ echo "Install Directory:"
pwd
echo ""
while true; do
read -p "Continue [y/N]" yn
read -p "Continue [y/N]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) echo Exiting; return 1 ;;
@ -389,36 +416,35 @@ echo "================================="
echo ""
echo "Configuring ${gamename} Server"
echo "================================="
sleep 1
echo "Copying ${systemdir}/ut2004.ini to ${systemdir}/${ini}"
cp ${systemdir}/UT2004.ini ${systemdir}/${ini}
sleep 1
echo ""
echo "Applying WebAdmin CharSet fix!"
echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1"
echo "Creating log directory"
mkdir -v ${logdir}
sleep 1
echo ""
echo "Applying WebAdmin ut2003.css fix!"
echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
sleep 1
echo ""
echo "Setting WebAdmin port to 8077"
sed -i 's/none}/none;/g' ${filesdir}/Web/ServerAdmin/ut2003.css
sed -i 's/underline}/underline;/g' ${filesdir}/Web/ServerAdmin/ut2003.css
sleep 1
echo ""
echo "Setting WebAdmin username and password"
sleep 1
echo ""
echo "Enabling Web Interface"
sleep 2
sed -i 's/CharSet="iso-8859-1"/CharSet="utf-8"/g' ${systemdir}/UWeb.int
sed -i 's/none}/none;/g' ${filesdir}/Web/ServerAdmin/ut2003.css
sed -i 's/underline}/underline;/g' ${filesdir}/Web/ServerAdmin/ut2003.css
sed -i 's/AdminName=/AdminName=admin/g' ${systemdir}/${ini}
sed -i 's/AdminPassword=/AdminPassword=utpass/g' ${systemdir}/${ini}
sleep 1
echo ""
echo "Enabling WebAdmin"
sed -i 's/bEnabled=False/bEnabled=True/g' ${systemdir}/${ini}
sleep 1
echo ""
echo "Setting WebAdmin port to 8077"
sed -i 's/ListenPort=80/ListenPort=8077/g' ${systemdir}/${ini}
mkdir ${logdir}
cd ${rootdir}
sleep 1
echo ""
cd ${rootdir}
echo "Default Settings"
echo "=============================="
echo "WebAdmin Details:"
@ -438,6 +464,7 @@ echo "================================="
echo ""
echo "To start server type:"
echo "${selfname} start"
echo ""
}
case "$1" in
@ -454,7 +481,7 @@ case "$1" in
debug)
fn_debugserver;;
map-compressor)
fn_compressmaps;;
fn_compressmaps;;
email-test)
fn_emailtest;;
*)

Loading…
Cancel
Save