|
@ -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}" |
|
|