Browse Source

Fix some bugs with Tmux

pull/10/head
Dh0mp5eur 12 years ago
parent
commit
ce9f8bb4c1
  1. 12
      CounterStrike/csserver
  2. 12
      CounterStrikeGlobalOffensive/csgoserver
  3. 12
      CounterStrikeSource/cssserver
  4. 12
      DayOfDefeatSource/dodsserver
  5. 12
      HalfLife2Deathmatch/hl2dmserver
  6. 12
      KillingFloor/kfserver
  7. 12
      Left4Dead2/l4d2server
  8. 12
      NaturalSelection2/ns2server
  9. 12
      RedOrchestra/roserver
  10. 12
      TeamFortress2/tf2server
  11. 12
      TheHiddenSource/thsserver
  12. 12
      UnrealTournament2004/ut2k4server
  13. 12
      UnrealTournament99/ut99server

12
CounterStrike/csserver

@ -154,12 +154,12 @@ 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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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}
sleep 1 sleep 1
tmux attach-session -t $(tmux list-sessions|awk '{print $1}') tmux attach-session -t ${servicename}
else else
echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running"
sleep 0.5 sleep 0.5
@ -194,7 +194,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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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
@ -407,11 +407,11 @@ fn_startserver
fn_stopserver(){ fn_stopserver(){
fn_rootcheck fn_rootcheck
fn_syscheck 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 -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
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 -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} echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog}
else else
@ -435,7 +435,7 @@ mv ${scriptlog} ${scriptlogdate}
mv ${consolelog} ${consolelogdate} mv ${consolelog} ${consolelogdate}
cd ${filesdir} cd ${filesdir}
tmux new-session -d -s ${servicename} "./hlds_run ${parms} |tee -a ${consolelog}" 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 sleep 1
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}"

12
CounterStrikeGlobalOffensive/csgoserver

@ -154,12 +154,12 @@ 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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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}
sleep 1 sleep 1
tmux attach-session -t $(tmux list-sessions|awk '{print $1}') tmux attach-session -t ${servicename}
else else
echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running"
sleep 0.5 sleep 0.5
@ -194,7 +194,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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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
@ -407,11 +407,11 @@ fn_startserver
fn_stopserver(){ fn_stopserver(){
fn_rootcheck fn_rootcheck
fn_syscheck 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 -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
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 -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} echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog}
else else
@ -435,7 +435,7 @@ mv ${scriptlog} ${scriptlogdate}
mv ${consolelog} ${consolelogdate} mv ${consolelog} ${consolelogdate}
cd ${filesdir} cd ${filesdir}
tmux new-session -d -s ${servicename} "./srcds_run ${parms} |tee -a ${consolelog}" 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 sleep 1
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}"

12
CounterStrikeSource/cssserver

@ -153,12 +153,12 @@ 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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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}
sleep 1 sleep 1
tmux attach-session -t $(tmux list-sessions|awk '{print $1}') tmux attach-session -t ${servicename}
else else
echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running"
sleep 0.5 sleep 0.5
@ -193,7 +193,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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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
@ -406,11 +406,11 @@ fn_startserver
fn_stopserver(){ fn_stopserver(){
fn_rootcheck fn_rootcheck
fn_syscheck 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 -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
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 -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} echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog}
else else
@ -434,7 +434,7 @@ mv ${scriptlog} ${scriptlogdate}
mv ${consolelog} ${consolelogdate} mv ${consolelog} ${consolelogdate}
cd ${filesdir} cd ${filesdir}
tmux new-session -d -s ${servicename} "./srcds_run ${parms} |tee -a ${consolelog}" 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 sleep 1
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}"

12
DayOfDefeatSource/dodsserver

@ -153,12 +153,12 @@ 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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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}
sleep 1 sleep 1
tmux attach-session -t $(tmux list-sessions|awk '{print $1}') tmux attach-session -t ${servicename}
else else
echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running"
sleep 0.5 sleep 0.5
@ -193,7 +193,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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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
@ -404,11 +404,11 @@ fn_startserver
fn_stopserver(){ fn_stopserver(){
fn_rootcheck fn_rootcheck
fn_syscheck 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 -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
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 -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} echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog}
else else
@ -432,7 +432,7 @@ mv ${scriptlog} ${scriptlogdate}
mv ${consolelog} ${consolelogdate} mv ${consolelog} ${consolelogdate}
cd ${filesdir} cd ${filesdir}
tmux new-session -d -s ${servicename} "./srcds_run ${parms} |tee -a ${consolelog}" 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 sleep 1
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}"

12
HalfLife2Deathmatch/hl2dmserver

@ -153,12 +153,12 @@ 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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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}
sleep 1 sleep 1
tmux attach-session -t $(tmux list-sessions|awk '{print $1}') tmux attach-session -t ${servicename}
else else
echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running"
sleep 0.5 sleep 0.5
@ -193,7 +193,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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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
@ -406,11 +406,11 @@ fn_startserver
fn_stopserver(){ fn_stopserver(){
fn_rootcheck fn_rootcheck
fn_syscheck 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 -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
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 -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} echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog}
else else
@ -434,7 +434,7 @@ mv ${scriptlog} ${scriptlogdate}
mv ${consolelog} ${consolelogdate} mv ${consolelog} ${consolelogdate}
cd ${filesdir} cd ${filesdir}
tmux new-session -d -s ${servicename} "./srcds_run ${parms} |tee -a ${consolelog}" 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 sleep 1
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}"

12
KillingFloor/kfserver

@ -214,12 +214,12 @@ 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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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}
sleep 1 sleep 1
tmux attach-session -t $(tmux list-sessions|awk '{print $1}') tmux attach-session -t ${servicename}
else else
echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running"
sleep 0.5 sleep 0.5
@ -254,7 +254,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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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
@ -505,11 +505,11 @@ fn_startserver
fn_stopserver(){ fn_stopserver(){
fn_rootcheck fn_rootcheck
fn_syscheck 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 -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
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 -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} echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog}
else else
@ -534,7 +534,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}"
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 sleep 1
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}"

12
Left4Dead2/l4d2server

@ -153,12 +153,12 @@ 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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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}
sleep 1 sleep 1
tmux attach-session -t $(tmux list-sessions|awk '{print $1}') tmux attach-session -t ${servicename}
else else
echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running"
sleep 0.5 sleep 0.5
@ -193,7 +193,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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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
@ -406,11 +406,11 @@ fn_startserver
fn_stopserver(){ fn_stopserver(){
fn_rootcheck fn_rootcheck
fn_syscheck 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 -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
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 -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} echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog}
else else
@ -434,7 +434,7 @@ mv ${scriptlog} ${scriptlogdate}
mv ${consolelog} ${consolelogdate} mv ${consolelog} ${consolelogdate}
cd ${filesdir} cd ${filesdir}
tmux new-session -d -s ${servicename} "./srcds_run ${parms} |tee -a ${consolelog}" 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 sleep 1
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}"

12
NaturalSelection2/ns2server

@ -159,12 +159,12 @@ 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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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}
sleep 1 sleep 1
tmux attach-session -t $(tmux list-sessions|awk '{print $1}') tmux attach-session -t ${servicename}
else else
echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running"
sleep 0.5 sleep 0.5
@ -199,7 +199,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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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
@ -405,11 +405,11 @@ fn_startserver
fn_stopserver(){ fn_stopserver(){
fn_rootcheck fn_rootcheck
fn_syscheck 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 -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
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 -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} echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog}
else else
@ -433,7 +433,7 @@ mv ${scriptlog} ${scriptlogdate}
mv ${consolelog} ${consolelogdate} mv ${consolelog} ${consolelogdate}
cd ${filesdir} cd ${filesdir}
tmux new-session -d -s ${servicename} "./server_linux32 ${parms} |tee -a ${consolelog}" 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 sleep 1
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}"

12
RedOrchestra/roserver

@ -214,12 +214,12 @@ 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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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}
sleep 1 sleep 1
tmux attach-session -t $(tmux list-sessions|awk '{print $1}') tmux attach-session -t ${servicename}
else else
echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running"
sleep 0.5 sleep 0.5
@ -254,7 +254,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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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
@ -503,11 +503,11 @@ fn_startserver
fn_stopserver(){ fn_stopserver(){
fn_rootcheck fn_rootcheck
fn_syscheck 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 -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
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 -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} echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog}
else else
@ -532,7 +532,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}"
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 sleep 1
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}"

12
TeamFortress2/tf2server

@ -154,12 +154,12 @@ 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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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}
sleep 1 sleep 1
tmux attach-session -t $(tmux list-sessions|awk '{print $1}') tmux attach-session -t ${servicename}
else else
echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running"
sleep 0.5 sleep 0.5
@ -194,7 +194,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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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
@ -407,11 +407,11 @@ fn_startserver
fn_stopserver(){ fn_stopserver(){
fn_rootcheck fn_rootcheck
fn_syscheck 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 -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
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 -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} echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog}
else else
@ -435,7 +435,7 @@ mv ${scriptlog} ${scriptlogdate}
mv ${consolelog} ${consolelogdate} mv ${consolelog} ${consolelogdate}
cd ${filesdir} cd ${filesdir}
tmux new-session -d -s ${servicename} "./srcds_run ${parms} |tee -a ${consolelog}" 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 sleep 1
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}"

12
TheHiddenSource/thsserver

@ -148,12 +148,12 @@ 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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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}
sleep 1 sleep 1
tmux attach-session -t $(tmux list-sessions|awk '{print $1}') tmux attach-session -t ${servicename}
else else
echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running"
sleep 0.5 sleep 0.5
@ -188,7 +188,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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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
@ -401,11 +401,11 @@ fn_startserver
fn_stopserver(){ fn_stopserver(){
fn_rootcheck fn_rootcheck
fn_syscheck 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 -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
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 -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} echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog}
else else
@ -429,7 +429,7 @@ mv ${scriptlog} ${scriptlogdate}
mv ${consolelog} ${consolelogdate} mv ${consolelog} ${consolelogdate}
cd ${filesdir} cd ${filesdir}
tmux new-session -d -s ${servicename} "./srcds_run ${parms} |tee -a ${consolelog}" 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 sleep 1
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}"

12
UnrealTournament2004/ut2k4server

@ -172,12 +172,12 @@ 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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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}
sleep 1 sleep 1
tmux attach-session -t $(tmux list-sessions|awk '{print $1}') tmux attach-session -t ${servicename}
else else
echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running"
sleep 0.5 sleep 0.5
@ -212,7 +212,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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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
@ -436,11 +436,11 @@ fn_startserver
fn_stopserver(){ fn_stopserver(){
fn_rootcheck fn_rootcheck
fn_syscheck 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 -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
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 -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} echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog}
else else
@ -464,7 +464,7 @@ mv ${scriptlog} ${scriptlogdate}
mv ${consolelog} ${consolelogdate} 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}"
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 sleep 1
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}"

12
UnrealTournament99/ut99server

@ -172,12 +172,12 @@ 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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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}
sleep 1 sleep 1
tmux attach-session -t $(tmux list-sessions|awk '{print $1}') tmux attach-session -t ${servicename}
else else
echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running" echo -e "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename} console: ${servername} not running"
sleep 0.5 sleep 0.5
@ -212,7 +212,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|wc -l) tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${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
@ -436,11 +436,11 @@ fn_startserver
fn_stopserver(){ fn_stopserver(){
fn_rootcheck fn_rootcheck
fn_syscheck 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 -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
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 -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} echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog}
else else
@ -464,7 +464,7 @@ mv ${scriptlog} ${scriptlogdate}
mv ${consolelog} ${consolelogdate} 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}"
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 sleep 1
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}"

Loading…
Cancel
Save