diff --git a/CounterStrike/csserver b/CounterStrike/csserver index 5923dfd89..242409f6c 100644 --- a/CounterStrike/csserver +++ b/CounterStrike/csserver @@ -21,7 +21,7 @@ parms="-game cstrike +map ${defaultmap} -strictportbind -port ${port} +clientpor #### Advanced Variables #### # Steam -appid="90" +appid="90 -beta beta" # Server Details servicename="cs-server" @@ -536,6 +536,8 @@ echo "=================================" echo "app_update ${appid} validate" >> install.txt echo "quit" >> install.txt STEAMEXE=steamcmd ./steam.sh +runscript install.txt + STEAMEXE=steamcmd ./steam.sh +runscript install.txt + STEAMEXE=steamcmd ./steam.sh +runscript install.txt rm install.txt echo "" echo "=================================" diff --git a/CounterStrikeSource/cssserver b/CounterStrikeSource/cssserver index b188f222e..534b21087 100644 --- a/CounterStrikeSource/cssserver +++ b/CounterStrikeSource/cssserver @@ -73,7 +73,7 @@ fi } 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 fn_serverquery echo -en "\r[\e[0;36m INFO \e[0;39m] ${servicename}: ${servername} is already running" @@ -158,7 +158,7 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" 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 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} @@ -198,7 +198,7 @@ while true; do * ) echo "Please answer yes or no.";; esac 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 echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -411,7 +411,7 @@ fn_startserver fn_stopserver(){ fn_rootcheck 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 -e "$(date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 @@ -440,7 +440,7 @@ mv ${consolelog} ${consolelogdate} cd ${filesdir} tmux new-session -d -s ${servicename} "./srcds_run ${parms} |tee -a ${consolelog}" 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 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} diff --git a/DayOfDefeatSource/dodsserver b/DayOfDefeatSource/dodsserver index e4857aa9d..1a668a2d2 100644 --- a/DayOfDefeatSource/dodsserver +++ b/DayOfDefeatSource/dodsserver @@ -72,7 +72,7 @@ fi } 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 fn_serverquery echo -en "\r[\e[0;36m INFO \e[0;39m] ${servicename}: ${servername} is already running" @@ -157,7 +157,7 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" 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 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} @@ -197,7 +197,7 @@ while true; do * ) echo "Please answer yes or no.";; esac 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 echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -410,7 +410,7 @@ fn_startserver fn_stopserver(){ fn_rootcheck 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 -e "$(date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 @@ -439,7 +439,7 @@ mv ${consolelog} ${consolelogdate} cd ${filesdir} tmux new-session -d -s ${servicename} "./srcds_run ${parms} |tee -a ${consolelog}" 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 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} diff --git a/HalfLife2Deathmatch/hl2dmserver b/HalfLife2Deathmatch/hl2dmserver index 40bd693b8..4949a4ea6 100644 --- a/HalfLife2Deathmatch/hl2dmserver +++ b/HalfLife2Deathmatch/hl2dmserver @@ -73,7 +73,7 @@ fi } 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 fn_serverquery echo -en "\r[\e[0;36m INFO \e[0;39m] ${servicename}: ${servername} is already running" @@ -158,7 +158,7 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" 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 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} @@ -198,7 +198,7 @@ while true; do * ) echo "Please answer yes or no.";; esac 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 echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -411,7 +411,7 @@ fn_startserver fn_stopserver(){ fn_rootcheck 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 -e "$(date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 @@ -440,7 +440,7 @@ mv ${consolelog} ${consolelogdate} cd ${filesdir} tmux new-session -d -s ${servicename} "./srcds_run ${parms} |tee -a ${consolelog}" 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 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} diff --git a/Left4Dead2/l4d2server b/Left4Dead2/l4d2server index a84a37d51..d68114ce3 100644 --- a/Left4Dead2/l4d2server +++ b/Left4Dead2/l4d2server @@ -73,7 +73,7 @@ fi } 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 fn_serverquery echo -en "\r[\e[0;36m INFO \e[0;39m] ${servicename}: ${servername} is already running" @@ -158,7 +158,7 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" 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 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} @@ -198,7 +198,7 @@ while true; do * ) echo "Please answer yes or no.";; esac 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 echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -411,7 +411,7 @@ fn_startserver fn_stopserver(){ fn_rootcheck 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 -e "$(date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 @@ -440,7 +440,7 @@ mv ${consolelog} ${consolelogdate} cd ${filesdir} tmux new-session -d -s ${servicename} "./srcds_run ${parms} |tee -a ${consolelog}" 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 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} diff --git a/Mumble/mumbleserver b/Mumble/mumbleserver index 34b7a6463..5316c0994 100644 --- a/Mumble/mumbleserver +++ b/Mumble/mumbleserver @@ -50,7 +50,7 @@ fi fn_runcheck(){ # already running check -pidwc=$(screen -ls |grep ${servicename} |awk -F . '{print $1}'|awk '{print $1}'|wc -l) +pidwc=$(screen -ls |grep -E "^${servicename}:" |awk -F . '{print $1}'|awk '{print $1}'|wc -l) if [ ${pidwc} -eq 1 ];then 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} @@ -93,7 +93,7 @@ while true; do * ) echo "Please answer yes or no.";; esac done -pidwc=$(screen -ls |grep ${servicename} |awk -F . '{print $1}'|awk '{print $1}'|wc -l) +pidwc=$(screen -ls |grep -E "^${servicename}:" |awk -F . '{print $1}'|awk '{print $1}'|wc -l) if [ ${pidwc} -eq 1 ];then echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -229,7 +229,7 @@ echo -e "[\e[0;32m OK \e[0;39m] Starting ${servicename}: ${servername}" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Starting ${servername}" >> ${logfile} screen -d -m -S ${servicename} ./murmur.x86 -fg -ini ${ini} sleep 1 -pidwc=$(screen -ls |grep ${servicename} |awk -F . '{print $1}'|awk '{print $1}'|wc -l) +pidwc=$(screen -ls |grep -E "^${servicename}:" |awk -F . '{print $1}'|awk '{print $1}'|wc -l) if [ ${pidwc} -eq 0 ];then echo -e "[\e[0;31m FAIL \e[0;39m] ${servicename}: ${servername} failed to start" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} failed to start" >> ${logfile} @@ -239,14 +239,14 @@ fi fn_stopserver(){ fn_rootcheck fn_syscheck -pid=$(screen -ls |grep ${servicename} |awk -F . '{print $1}'|awk '{print $1}') +pid=$(screen -ls |grep -E "^${servicename}:" |awk -F . '{print $1}'|awk '{print $1}') if [ -z ${pid} ];then echo -e "[\e[0;36m INFO \e[0;39m] ${servicename}: ${servername} is already stopped" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${logfile} else echo -e "[\e[0;32m OK \e[0;39m] Stopping ${servicename}: ${servername}" echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${logfile} - pkill -P `screen -ls |grep ${servicename} |awk -F . '{print $1}'|awk '{print $1}'` + pkill -P `screen -ls |grep -E "^${servicename}:" |awk -F . '{print $1}'|awk '{print $1}'` screen -wipe > /dev/null 2>&1 fi } diff --git a/NaturalSelection2/ns2server b/NaturalSelection2/ns2server index 0f386f57b..a00c7c0a7 100644 --- a/NaturalSelection2/ns2server +++ b/NaturalSelection2/ns2server @@ -77,7 +77,7 @@ fi } 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 fn_serverquery echo -en "\r[\e[0;36m INFO \e[0;39m] ${servicename}: ${servername} is already running" @@ -162,7 +162,7 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" 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 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} @@ -202,7 +202,7 @@ while true; do * ) echo "Please answer yes or no.";; esac 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 echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -408,7 +408,7 @@ fn_startserver fn_stopserver(){ fn_rootcheck 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 -e "$(date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 @@ -437,7 +437,7 @@ mv ${consolelog} ${consolelogdate} cd ${filesdir} tmux new-session -d -s ${servicename} "./server_linux32 ${parms} |tee -a ${consolelog}" 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 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} diff --git a/NoMoreRoomInHell/nmrihserver b/NoMoreRoomInHell/nmrihserver index 885651db6..b136bf81f 100644 --- a/NoMoreRoomInHell/nmrihserver +++ b/NoMoreRoomInHell/nmrihserver @@ -77,7 +77,7 @@ fi } 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 fn_serverquery echo -en "\r[\e[0;36m INFO \e[0;39m] ${servicename}: ${servername} is already running" @@ -162,7 +162,7 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" 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 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} @@ -202,7 +202,7 @@ while true; do * ) echo "Please answer yes or no.";; esac 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 echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -415,7 +415,7 @@ fn_startserver fn_stopserver(){ fn_rootcheck 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 -e "$(date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 @@ -444,7 +444,7 @@ mv ${consolelog} ${consolelogdate} cd ${filesdir}/srcds tmux new-session -d -s ${servicename} "./srcds_nmrih ${parms} -debug|tee -a ${consolelog}" 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 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} diff --git a/RedOrchestra/roserver b/RedOrchestra/roserver index 303d64ec2..b68135d62 100644 --- a/RedOrchestra/roserver +++ b/RedOrchestra/roserver @@ -70,7 +70,7 @@ fi } 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 fn_serverquery echo -en "\r[\e[0;36m INFO \e[0;39m] ${servicename}: ${servername} is already running" @@ -224,7 +224,7 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" 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 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} @@ -264,7 +264,7 @@ while true; do * ) echo "Please answer yes or no.";; esac 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 echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -507,7 +507,7 @@ fn_startserver fn_stopserver(){ fn_rootcheck 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 -e "$(date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 @@ -537,7 +537,7 @@ cd ${systemdir} tmux new-session -d -s ${servicename} "./ucc-bin ${parms} |tee -a ${consolelog}" 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 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} diff --git a/TeamFortress2/tf2server b/TeamFortress2/tf2server index e7133b715..e87861088 100644 --- a/TeamFortress2/tf2server +++ b/TeamFortress2/tf2server @@ -73,7 +73,7 @@ fi } 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 fn_serverquery echo -en "\r[\e[0;36m INFO \e[0;39m] ${servicename}: ${servername} is already running" @@ -158,7 +158,7 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" 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 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} @@ -198,7 +198,7 @@ while true; do * ) echo "Please answer yes or no.";; esac 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 echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -411,7 +411,7 @@ fn_startserver fn_stopserver(){ fn_rootcheck 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 -e "$(date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 @@ -440,7 +440,7 @@ mv ${consolelog} ${consolelogdate} cd ${filesdir} tmux new-session -d -s ${servicename} "./srcds_run ${parms} |tee -a ${consolelog}" 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 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} diff --git a/TheHiddenSource/thsserver b/TheHiddenSource/thsserver index d8c6cfd07..cf64a4f00 100644 --- a/TheHiddenSource/thsserver +++ b/TheHiddenSource/thsserver @@ -70,7 +70,7 @@ fi } 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 fn_serverquery echo -en "\r[\e[0;36m INFO \e[0;39m] ${servicename}: ${servername} is already running" @@ -155,7 +155,7 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" 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 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} @@ -195,7 +195,7 @@ while true; do * ) echo "Please answer yes or no.";; esac 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 echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -242,7 +242,7 @@ while true; do * ) echo "Please answer yes or no.";; esac 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 echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -455,7 +455,7 @@ fn_startserver fn_stopserver(){ fn_rootcheck 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 -e "$(date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 @@ -484,7 +484,7 @@ mv ${consolelog} ${consolelogdate} cd ${filesdir} tmux new-session -d -s ${servicename} "./srcds_run ${parms} |tee -a ${consolelog}" 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 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} diff --git a/UnrealTournament2004/ut2k4server b/UnrealTournament2004/ut2k4server index 948e0fdb9..de2ac9ffd 100644 --- a/UnrealTournament2004/ut2k4server +++ b/UnrealTournament2004/ut2k4server @@ -63,7 +63,7 @@ fi } 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 fn_serverquery echo -en "\r[\e[0;36m INFO \e[0;39m] ${servicename}: ${servername} is already running" @@ -188,7 +188,7 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" 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 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} @@ -228,7 +228,7 @@ while true; do * ) echo "Please answer yes or no.";; esac 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 echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -454,7 +454,7 @@ fn_startserver fn_stopserver(){ fn_rootcheck 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 -e "$(date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 @@ -488,7 +488,7 @@ else tmux new-session -d -s ${servicename} "./ucc-bin ${parms} |tee -a ${consolelog}" fi 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 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} diff --git a/UnrealTournament99/ut99server b/UnrealTournament99/ut99server index 211b64a5b..6008eb350 100644 --- a/UnrealTournament99/ut99server +++ b/UnrealTournament99/ut99server @@ -63,7 +63,7 @@ fi } 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 fn_serverquery echo -en "\r[\e[0;36m INFO \e[0;39m] ${servicename}: ${servername} is already running" @@ -178,7 +178,7 @@ esac done echo -en "\r[ .... ] Starting ${servicename} console" 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 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} @@ -218,7 +218,7 @@ while true; do * ) echo "Please answer yes or no.";; esac 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 echo -e "\e[0;31mWARNING!\e[0;39m ${servicename} is currently running" while true; do @@ -444,7 +444,7 @@ fn_startserver fn_stopserver(){ fn_rootcheck 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 -e "$(date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} sleep 0.5 @@ -473,7 +473,7 @@ mv ${consolelog} ${consolelogdate} cd ${systemdir} tmux new-session -d -s ${servicename} "./ucc-bin ${parms} |tee -a ${consolelog}" 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 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}