优化启动脚本

pull/109/head
Mr Chen 6 years ago
parent c40f35a3d3
commit 24ed7e3460
  1. 13
      scripts/init.d/mw.tpl

@ -8,9 +8,18 @@ mw_start(){
if [ "$isStart" == '' ];then if [ "$isStart" == '' ];then
echo -e "Starting mw... \c" echo -e "Starting mw... \c"
cd $mw_path && gunicorn -c setting.py app:app cd $mw_path && gunicorn -c setting.py app:app
sleep 0.2
port=$(cat ${mw_path}/data/port.pl) port=$(cat ${mw_path}/data/port.pl)
isStart=$(lsof -i :$port|grep LISTEN) isStart=""
while [[ "$isStart" == "" ]];
do
echo -e ".\c"
sleep 0.5
isStart=$(lsof -n -P -i:$port|grep LISTEN|grep -v grep|awk '{print $2}'|xargs)
let n+=1
if [ $n -gt 8 ];then
break;
fi
done
if [ "$isStart" == '' ];then if [ "$isStart" == '' ];then
echo -e "\033[31mfailed\033[0m" echo -e "\033[31mfailed\033[0m"
echo '------------------------------------------------------' echo '------------------------------------------------------'

Loading…
Cancel
Save