Browse Source

Added example for Objective mode

Also added grep -E "^${servicename}:" for more accurate detection of the
tmux session
pull/30/head
Daniel Gibbs 12 years ago
parent
commit
42009bdb44
  1. 13
      KillingFloor/kfserver

13
KillingFloor/kfserver

@ -50,6 +50,9 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
# Start Variables # Start Variables
defaultmap="KF-BioticsLab.rom" defaultmap="KF-BioticsLab.rom"
parms="server ${defaultmap}?game=KFmod.KFGameType?VACSecured=true -nohomedir ini=${ini} log=${logfile}" parms="server ${defaultmap}?game=KFmod.KFGameType?VACSecured=true -nohomedir ini=${ini} log=${logfile}"
# Example Parameters for Objective mode
#defaultmap="KFO-Steamland"
#parms="server ${defaultmap}?Game=KFStoryGame.KFStoryGame?VACSecured=true -nohomedir ini=${ini} log=${logfile}"
##### Script ##### ##### Script #####
# Do not edit # Do not edit
@ -71,7 +74,7 @@ fi
} }
fn_runcheck(){ fn_runcheck(){
tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -E "^${servicename}:"|wc -l)
if [ ${tmuxwc} -eq 1 ];then if [ ${tmuxwc} -eq 1 ];then
fn_serverquery fn_serverquery
echo -en "\r[\e[0;36m INFO \e[0;39m] ${servicename}: ${servername} is already running" echo -en "\r[\e[0;36m INFO \e[0;39m] ${servicename}: ${servername} is already running"
@ -225,7 +228,7 @@ esac
done done
echo -en "\r[ .... ] Starting ${servicename} console" echo -en "\r[ .... ] Starting ${servicename} console"
sleep 0.5 sleep 0.5
tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -E "^${servicename}:"|wc -l)
if [ ${tmuxwc} -eq 1 ];then if [ ${tmuxwc} -eq 1 ];then
echo -e "\r[\e[0;32m OK \e[0;39m] Starting ${servicename} console" echo -e "\r[\e[0;32m OK \e[0;39m] Starting ${servicename} console"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${servername} console accessed" >> ${scriptlog} echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${servername} console accessed" >> ${scriptlog}
@ -265,7 +268,7 @@ while true; do
* ) echo "Please answer yes or no.";; * ) echo "Please answer yes or no.";;
esac esac
done done
tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -E "^${servicename}:"|wc -l)
if [ ${tmuxwc} -eq 1 ];then if [ ${tmuxwc} -eq 1 ];then
echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running"
while true; do while true; do
@ -508,7 +511,7 @@ fn_startserver
fn_stopserver(){ fn_stopserver(){
fn_rootcheck fn_rootcheck
fn_syscheck fn_syscheck
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l) pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
echo -en "[ .... ] Stopping ${servicename}: ${servername}" echo -en "[ .... ] Stopping ${servicename}: ${servername}"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog}
sleep 0.5 sleep 0.5
@ -537,7 +540,7 @@ mv ${consolelog} ${consolelogdate}
cd ${systemdir} cd ${systemdir}
tmux new-session -d -s ${servicename} "./ucc-bin ${parms} |tee -a ${consolelog}" tmux new-session -d -s ${servicename} "./ucc-bin ${parms} |tee -a ${consolelog}"
sleep 1 sleep 1
tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
if [ ${tmuxwc} -eq 0 ];then if [ ${tmuxwc} -eq 0 ];then
echo -en "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename}: Failed to start ${servername}" echo -en "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename}: Failed to start ${servername}"
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: failed to start ${servername}" >> ${scriptlog} echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: failed to start ${servername}" >> ${scriptlog}

Loading…
Cancel
Save