mdserver-web/cli.sh

58 lines
958 B
Bash
Raw Normal View History

2018-12-12 06:30:42 -05:00
#!/bin/bash
2021-10-31 04:09:33 -04:00
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
DIR=$(cd "$(dirname "$0")"; pwd)
MDIR=$(dirname "$DIR")
2018-12-12 06:30:42 -05:00
2021-10-31 04:09:33 -04:00
PATH=$PATH:$DIR/bin
2021-11-02 06:20:35 -04:00
if [ -f bin/activate ];then
source bin/activate
fi
2018-12-12 06:30:42 -05:00
2022-06-20 08:29:56 -04:00
# export LC_ALL="en_US.UTF-8"
2021-11-12 06:08:08 -05:00
2018-12-12 06:30:42 -05:00
mw_start(){
2019-02-18 11:01:30 -05:00
gunicorn -c setting.py app:app
2021-05-08 11:19:53 -04:00
python3 task.py &
2018-12-12 06:30:42 -05:00
}
2018-12-12 23:56:06 -05:00
mw_start_debug(){
2019-02-19 04:29:07 -05:00
2021-05-08 11:19:53 -04:00
python3 task.py &
2019-02-18 22:37:24 -05:00
gunicorn -b :7200 -k gevent -w 1 app:app
# gunicorn -b :7200 -k eventlet -w 1 app:app
2018-12-12 23:56:06 -05:00
}
2022-04-10 02:25:13 -04:00
mw_start_debug2(){
2022-06-10 12:21:20 -04:00
python3 task.py &
2022-06-24 10:05:09 -04:00
gunicorn -b :7200 -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker -w 1 app:app
2022-06-10 12:21:20 -04:00
2022-04-10 02:25:13 -04:00
}
2018-12-12 06:30:42 -05:00
mw_stop()
{
2019-03-14 00:53:21 -04:00
PLIST=`ps -ef|grep app:app |grep -v grep|awk '{print $2}'`
for i in $PLIST
do
kill -9 $i
done
2018-12-12 06:30:42 -05:00
ps -ef|grep task.py |grep -v grep|awk '{print $2}'|xargs kill -9
}
case "$1" in
'start') mw_start;;
'stop') mw_stop;;
2018-12-12 08:35:04 -05:00
'restart')
mw_stop
mw_start
;;
2018-12-12 23:56:06 -05:00
'debug')
mw_stop
mw_start_debug
;;
2022-04-10 02:25:13 -04:00
'debug2')
mw_stop
mw_start_debug2
;;
2018-12-12 06:30:42 -05:00
esac