Update cli.sh

pull/119/head
midoks 3 years ago
parent 43e3ea75d3
commit 03c94313dd
  1. 26
      cli.sh

@ -11,9 +11,33 @@ fi
# export LC_ALL="en_US.UTF-8" # export LC_ALL="en_US.UTF-8"
mw_start_task()
{
isStart=$(ps aux |grep 'task.py'|grep -v grep|awk '{print $2}')
if [ "$isStart" == '' ];then
echo -e "Starting mw-tasks... \c"
cd $DIR && python3 task.py >> ${DIR}/logs/task.log 2>&1 &
sleep 0.3
isStart=$(ps aux |grep 'task.py'|grep -v grep|awk '{print $2}')
if [ "$isStart" == '' ];then
echo -e "\033[31mfailed\033[0m"
echo '------------------------------------------------------'
tail -n 20 $DIR/logs/task.log
echo '------------------------------------------------------'
echo -e "\033[31mError: mw-tasks service startup failed.\033[0m"
return;
fi
echo -e "\033[32mdone\033[0m"
else
echo "Starting mw-tasks... mw-tasks (pid $(echo $isStart)) already running"
fi
}
mw_start(){ mw_start(){
gunicorn -c setting.py app:app gunicorn -c setting.py app:app
python3 task.py >> $DIR/logs/task.log 2>&1 & #安全启动
mw_start_task
} }

Loading…
Cancel
Save