From ce9f8bb4c139fe0a6a0086cb440ae4c9ce0c879f Mon Sep 17 00:00:00 2001 From: Dh0mp5eur Date: Mon, 21 Oct 2013 18:10:46 +0200 Subject: [PATCH] Fix some bugs with Tmux --- CounterStrike/csserver | 12 ++++++------ CounterStrikeGlobalOffensive/csgoserver | 12 ++++++------ CounterStrikeSource/cssserver | 12 ++++++------ DayOfDefeatSource/dodsserver | 12 ++++++------ HalfLife2Deathmatch/hl2dmserver | 12 ++++++------ KillingFloor/kfserver | 12 ++++++------ Left4Dead2/l4d2server | 12 ++++++------ NaturalSelection2/ns2server | 12 ++++++------ RedOrchestra/roserver | 12 ++++++------ TeamFortress2/tf2server | 12 ++++++------ TheHiddenSource/thsserver | 12 ++++++------ UnrealTournament2004/ut2k4server | 12 ++++++------ UnrealTournament99/ut99server | 12 ++++++------ 13 files changed, 78 insertions(+), 78 deletions(-) diff --git a/CounterStrike/csserver b/CounterStrike/csserver index 98aa1e277..234dc59d2 100644 --- a/CounterStrike/csserver +++ b/CounterStrike/csserver @@ -154,12 +154,12 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" sleep 0.5 -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then 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} sleep 1 - tmux attach-session -t $(tmux list-sessions|awk '{print $1}') + tmux attach-session -t ${servicename} else echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" sleep 0.5 @@ -194,7 +194,7 @@ while true; do * ) echo "Please answer yes or no.";; esac done -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -407,11 +407,11 @@ fn_startserver fn_stopserver(){ fn_rootcheck fn_syscheck -pid=$(tmux list-sessions 2>&1|awk '{print $1}') +pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l) echo -en "[ .... ] Stopping ${servicename}: ${servername}" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 -if [ "${pid}" == "failed" ];then +if [ "${pid}" == "0" ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Stopping ${servicename}: ${servername} is already stopped" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog} else @@ -435,7 +435,7 @@ mv ${scriptlog} ${scriptlogdate} mv ${consolelog} ${consolelogdate} cd ${filesdir} tmux new-session -d -s ${servicename} "./hlds_run ${parms} |tee -a ${consolelog}" -tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|wc -l` +tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l` sleep 1 if [ ${tmuxwc} -eq 0 ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename}: Failed to start ${servername}" diff --git a/CounterStrikeGlobalOffensive/csgoserver b/CounterStrikeGlobalOffensive/csgoserver index a355dadb3..8b494d332 100644 --- a/CounterStrikeGlobalOffensive/csgoserver +++ b/CounterStrikeGlobalOffensive/csgoserver @@ -154,12 +154,12 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" sleep 0.5 -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then 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} sleep 1 - tmux attach-session -t $(tmux list-sessions|awk '{print $1}') + tmux attach-session -t ${servicename} else echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" sleep 0.5 @@ -194,7 +194,7 @@ while true; do * ) echo "Please answer yes or no.";; esac done -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -407,11 +407,11 @@ fn_startserver fn_stopserver(){ fn_rootcheck fn_syscheck -pid=$(tmux list-sessions 2>&1|awk '{print $1}') +pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l) echo -en "[ .... ] Stopping ${servicename}: ${servername}" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 -if [ "${pid}" == "failed" ];then +if [ "${pid}" == "0" ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Stopping ${servicename}: ${servername} is already stopped" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog} else @@ -435,7 +435,7 @@ mv ${scriptlog} ${scriptlogdate} mv ${consolelog} ${consolelogdate} cd ${filesdir} tmux new-session -d -s ${servicename} "./srcds_run ${parms} |tee -a ${consolelog}" -tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|wc -l` +tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l` sleep 1 if [ ${tmuxwc} -eq 0 ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename}: Failed to start ${servername}" diff --git a/CounterStrikeSource/cssserver b/CounterStrikeSource/cssserver index 54d889a0a..6206bef58 100644 --- a/CounterStrikeSource/cssserver +++ b/CounterStrikeSource/cssserver @@ -153,12 +153,12 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" sleep 0.5 -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then 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} sleep 1 - tmux attach-session -t $(tmux list-sessions|awk '{print $1}') + tmux attach-session -t ${servicename} else echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" sleep 0.5 @@ -193,7 +193,7 @@ while true; do * ) echo "Please answer yes or no.";; esac done -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -406,11 +406,11 @@ fn_startserver fn_stopserver(){ fn_rootcheck fn_syscheck -pid=$(tmux list-sessions 2>&1|awk '{print $1}') +pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l) echo -en "[ .... ] Stopping ${servicename}: ${servername}" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 -if [ "${pid}" == "failed" ];then +if [ "${pid}" == "0" ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Stopping ${servicename}: ${servername} is already stopped" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog} else @@ -434,7 +434,7 @@ mv ${scriptlog} ${scriptlogdate} mv ${consolelog} ${consolelogdate} cd ${filesdir} tmux new-session -d -s ${servicename} "./srcds_run ${parms} |tee -a ${consolelog}" -tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|wc -l` +tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l` sleep 1 if [ ${tmuxwc} -eq 0 ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename}: Failed to start ${servername}" diff --git a/DayOfDefeatSource/dodsserver b/DayOfDefeatSource/dodsserver index 22c06dfcc..7b54b7843 100644 --- a/DayOfDefeatSource/dodsserver +++ b/DayOfDefeatSource/dodsserver @@ -153,12 +153,12 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" sleep 0.5 -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then 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} sleep 1 - tmux attach-session -t $(tmux list-sessions|awk '{print $1}') + tmux attach-session -t ${servicename} else echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" sleep 0.5 @@ -193,7 +193,7 @@ while true; do * ) echo "Please answer yes or no.";; esac done -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -404,11 +404,11 @@ fn_startserver fn_stopserver(){ fn_rootcheck fn_syscheck -pid=$(tmux list-sessions 2>&1|awk '{print $1}') +pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l) echo -en "[ .... ] Stopping ${servicename}: ${servername}" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 -if [ "${pid}" == "failed" ];then +if [ "${pid}" == "0" ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Stopping ${servicename}: ${servername} is already stopped" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog} else @@ -432,7 +432,7 @@ mv ${scriptlog} ${scriptlogdate} mv ${consolelog} ${consolelogdate} cd ${filesdir} tmux new-session -d -s ${servicename} "./srcds_run ${parms} |tee -a ${consolelog}" -tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|wc -l` +tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l` sleep 1 if [ ${tmuxwc} -eq 0 ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename}: Failed to start ${servername}" diff --git a/HalfLife2Deathmatch/hl2dmserver b/HalfLife2Deathmatch/hl2dmserver index b4a380c41..d3cafc5be 100644 --- a/HalfLife2Deathmatch/hl2dmserver +++ b/HalfLife2Deathmatch/hl2dmserver @@ -153,12 +153,12 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" sleep 0.5 -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then 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} sleep 1 - tmux attach-session -t $(tmux list-sessions|awk '{print $1}') + tmux attach-session -t ${servicename} else echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" sleep 0.5 @@ -193,7 +193,7 @@ while true; do * ) echo "Please answer yes or no.";; esac done -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -406,11 +406,11 @@ fn_startserver fn_stopserver(){ fn_rootcheck fn_syscheck -pid=$(tmux list-sessions 2>&1|awk '{print $1}') +pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l) echo -en "[ .... ] Stopping ${servicename}: ${servername}" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 -if [ "${pid}" == "failed" ];then +if [ "${pid}" == "0" ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Stopping ${servicename}: ${servername} is already stopped" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog} else @@ -434,7 +434,7 @@ mv ${scriptlog} ${scriptlogdate} mv ${consolelog} ${consolelogdate} cd ${filesdir} tmux new-session -d -s ${servicename} "./srcds_run ${parms} |tee -a ${consolelog}" -tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|wc -l` +tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l` sleep 1 if [ ${tmuxwc} -eq 0 ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename}: Failed to start ${servername}" diff --git a/KillingFloor/kfserver b/KillingFloor/kfserver index 5136b9845..3d37b2ff8 100644 --- a/KillingFloor/kfserver +++ b/KillingFloor/kfserver @@ -214,12 +214,12 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" sleep 0.5 -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then 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} sleep 1 - tmux attach-session -t $(tmux list-sessions|awk '{print $1}') + tmux attach-session -t ${servicename} else echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" sleep 0.5 @@ -254,7 +254,7 @@ while true; do * ) echo "Please answer yes or no.";; esac done -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -505,11 +505,11 @@ fn_startserver fn_stopserver(){ fn_rootcheck fn_syscheck -pid=$(tmux list-sessions 2>&1|awk '{print $1}') +pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l) echo -en "[ .... ] Stopping ${servicename}: ${servername}" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 -if [ "${pid}" == "failed" ];then +if [ "${pid}" == "0" ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Stopping ${servicename}: ${servername} is already stopped" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog} else @@ -534,7 +534,7 @@ mv ${consolelog} ${consolelogdate} cd ${systemdir} tmux new-session -d -s ${servicename} "./ucc-bin ${parms} |tee -a ${consolelog}" -tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|wc -l` +tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l` sleep 1 if [ ${tmuxwc} -eq 0 ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename}: Failed to start ${servername}" diff --git a/Left4Dead2/l4d2server b/Left4Dead2/l4d2server index a25e5b3cc..a9d4d3ba7 100644 --- a/Left4Dead2/l4d2server +++ b/Left4Dead2/l4d2server @@ -153,12 +153,12 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" sleep 0.5 -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then 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} sleep 1 - tmux attach-session -t $(tmux list-sessions|awk '{print $1}') + tmux attach-session -t ${servicename} else echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" sleep 0.5 @@ -193,7 +193,7 @@ while true; do * ) echo "Please answer yes or no.";; esac done -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -406,11 +406,11 @@ fn_startserver fn_stopserver(){ fn_rootcheck fn_syscheck -pid=$(tmux list-sessions 2>&1|awk '{print $1}') +pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l) echo -en "[ .... ] Stopping ${servicename}: ${servername}" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 -if [ "${pid}" == "failed" ];then +if [ "${pid}" == "0" ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Stopping ${servicename}: ${servername} is already stopped" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog} else @@ -434,7 +434,7 @@ mv ${scriptlog} ${scriptlogdate} mv ${consolelog} ${consolelogdate} cd ${filesdir} tmux new-session -d -s ${servicename} "./srcds_run ${parms} |tee -a ${consolelog}" -tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|wc -l` +tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l` sleep 1 if [ ${tmuxwc} -eq 0 ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename}: Failed to start ${servername}" diff --git a/NaturalSelection2/ns2server b/NaturalSelection2/ns2server index 040c66de6..0c5f7fd72 100644 --- a/NaturalSelection2/ns2server +++ b/NaturalSelection2/ns2server @@ -159,12 +159,12 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" sleep 0.5 -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then 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} sleep 1 - tmux attach-session -t $(tmux list-sessions|awk '{print $1}') + tmux attach-session -t ${servicename} else echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" sleep 0.5 @@ -199,7 +199,7 @@ while true; do * ) echo "Please answer yes or no.";; esac done -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -405,11 +405,11 @@ fn_startserver fn_stopserver(){ fn_rootcheck fn_syscheck -pid=$(tmux list-sessions 2>&1|awk '{print $1}') +pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l) echo -en "[ .... ] Stopping ${servicename}: ${servername}" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 -if [ "${pid}" == "failed" ];then +if [ "${pid}" == "0" ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Stopping ${servicename}: ${servername} is already stopped" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog} else @@ -433,7 +433,7 @@ mv ${scriptlog} ${scriptlogdate} mv ${consolelog} ${consolelogdate} cd ${filesdir} tmux new-session -d -s ${servicename} "./server_linux32 ${parms} |tee -a ${consolelog}" -tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|wc -l` +tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l` sleep 1 if [ ${tmuxwc} -eq 0 ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename}: Failed to start ${servername}" diff --git a/RedOrchestra/roserver b/RedOrchestra/roserver index a048015b0..c51469f33 100644 --- a/RedOrchestra/roserver +++ b/RedOrchestra/roserver @@ -214,12 +214,12 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" sleep 0.5 -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then 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} sleep 1 - tmux attach-session -t $(tmux list-sessions|awk '{print $1}') + tmux attach-session -t ${servicename} else echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" sleep 0.5 @@ -254,7 +254,7 @@ while true; do * ) echo "Please answer yes or no.";; esac done -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -503,11 +503,11 @@ fn_startserver fn_stopserver(){ fn_rootcheck fn_syscheck -pid=$(tmux list-sessions 2>&1|awk '{print $1}') +pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l) echo -en "[ .... ] Stopping ${servicename}: ${servername}" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 -if [ "${pid}" == "failed" ];then +if [ "${pid}" == "0" ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Stopping ${servicename}: ${servername} is already stopped" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog} else @@ -532,7 +532,7 @@ mv ${consolelog} ${consolelogdate} cd ${systemdir} tmux new-session -d -s ${servicename} "./ucc-bin ${parms} |tee -a ${consolelog}" -tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|wc -l` +tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l` sleep 1 if [ ${tmuxwc} -eq 0 ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename}: Failed to start ${servername}" diff --git a/TeamFortress2/tf2server b/TeamFortress2/tf2server index f58338e95..b82acbe5c 100644 --- a/TeamFortress2/tf2server +++ b/TeamFortress2/tf2server @@ -154,12 +154,12 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" sleep 0.5 -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then 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} sleep 1 - tmux attach-session -t $(tmux list-sessions|awk '{print $1}') + tmux attach-session -t ${servicename} else echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" sleep 0.5 @@ -194,7 +194,7 @@ while true; do * ) echo "Please answer yes or no.";; esac done -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -407,11 +407,11 @@ fn_startserver fn_stopserver(){ fn_rootcheck fn_syscheck -pid=$(tmux list-sessions 2>&1|awk '{print $1}') +pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l) echo -en "[ .... ] Stopping ${servicename}: ${servername}" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 -if [ "${pid}" == "failed" ];then +if [ "${pid}" == "0" ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Stopping ${servicename}: ${servername} is already stopped" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog} else @@ -435,7 +435,7 @@ mv ${scriptlog} ${scriptlogdate} mv ${consolelog} ${consolelogdate} cd ${filesdir} tmux new-session -d -s ${servicename} "./srcds_run ${parms} |tee -a ${consolelog}" -tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|wc -l` +tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l` sleep 1 if [ ${tmuxwc} -eq 0 ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename}: Failed to start ${servername}" diff --git a/TheHiddenSource/thsserver b/TheHiddenSource/thsserver index 8de6ec7b4..517d64af8 100644 --- a/TheHiddenSource/thsserver +++ b/TheHiddenSource/thsserver @@ -148,12 +148,12 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" sleep 0.5 -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then 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} sleep 1 - tmux attach-session -t $(tmux list-sessions|awk '{print $1}') + tmux attach-session -t ${servicename} else echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" sleep 0.5 @@ -188,7 +188,7 @@ while true; do * ) echo "Please answer yes or no.";; esac done -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -401,11 +401,11 @@ fn_startserver fn_stopserver(){ fn_rootcheck fn_syscheck -pid=$(tmux list-sessions 2>&1|awk '{print $1}') +pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l) echo -en "[ .... ] Stopping ${servicename}: ${servername}" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 -if [ "${pid}" == "failed" ];then +if [ "${pid}" == "0" ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Stopping ${servicename}: ${servername} is already stopped" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog} else @@ -429,7 +429,7 @@ mv ${scriptlog} ${scriptlogdate} mv ${consolelog} ${consolelogdate} cd ${filesdir} tmux new-session -d -s ${servicename} "./srcds_run ${parms} |tee -a ${consolelog}" -tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|wc -l` +tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l` sleep 1 if [ ${tmuxwc} -eq 0 ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename}: Failed to start ${servername}" diff --git a/UnrealTournament2004/ut2k4server b/UnrealTournament2004/ut2k4server index 4d2f6a2f6..ee624893c 100644 --- a/UnrealTournament2004/ut2k4server +++ b/UnrealTournament2004/ut2k4server @@ -172,12 +172,12 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" sleep 0.5 -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then 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} sleep 1 - tmux attach-session -t $(tmux list-sessions|awk '{print $1}') + tmux attach-session -t ${servicename} else echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" sleep 0.5 @@ -212,7 +212,7 @@ while true; do * ) echo "Please answer yes or no.";; esac done -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -436,11 +436,11 @@ fn_startserver fn_stopserver(){ fn_rootcheck fn_syscheck -pid=$(tmux list-sessions 2>&1|awk '{print $1}') +pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l) echo -en "[ .... ] Stopping ${servicename}: ${servername}" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 -if [ "${pid}" == "failed" ];then +if [ "${pid}" == "0" ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Stopping ${servicename}: ${servername} is already stopped" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog} else @@ -464,7 +464,7 @@ mv ${scriptlog} ${scriptlogdate} mv ${consolelog} ${consolelogdate} cd ${systemdir} tmux new-session -d -s ${servicename} "./ucc-bin ${parms} |tee -a ${consolelog}" -tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|wc -l` +tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l` sleep 1 if [ ${tmuxwc} -eq 0 ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename}: Failed to start ${servername}" diff --git a/UnrealTournament99/ut99server b/UnrealTournament99/ut99server index 8a9120f6c..1be44e2ac 100644 --- a/UnrealTournament99/ut99server +++ b/UnrealTournament99/ut99server @@ -172,12 +172,12 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" sleep 0.5 -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then 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} sleep 1 - tmux attach-session -t $(tmux list-sessions|awk '{print $1}') + tmux attach-session -t ${servicename} else echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" sleep 0.5 @@ -212,7 +212,7 @@ while true; do * ) echo "Please answer yes or no.";; esac done -tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|wc -l) +tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) if [ ${tmuxwc} -eq 1 ];then echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -436,11 +436,11 @@ fn_startserver fn_stopserver(){ fn_rootcheck fn_syscheck -pid=$(tmux list-sessions 2>&1|awk '{print $1}') +pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l) echo -en "[ .... ] Stopping ${servicename}: ${servername}" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 -if [ "${pid}" == "failed" ];then +if [ "${pid}" == "0" ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Stopping ${servicename}: ${servername} is already stopped" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog} else @@ -464,7 +464,7 @@ mv ${scriptlog} ${scriptlogdate} mv ${consolelog} ${consolelogdate} cd ${systemdir} tmux new-session -d -s ${servicename} "./ucc-bin ${parms} |tee -a ${consolelog}" -tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|wc -l` +tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l` sleep 1 if [ ${tmuxwc} -eq 0 ];then echo -en "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename}: Failed to start ${servername}"