-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeploy_example.sh
39 lines (34 loc) · 924 Bytes
/
deploy_example.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
### BEGIN SCRIPT INFO
# Description: uwsgi service startup management script.
### END SCRIPT INFO
# 加载python环境
current_path=$(cd $(dirname $0);pwd)
source ~/.bashrc
source $current_path/env/bin/activate
export FLASK_ENV=production
case "$1" in
start)
pids=`ps aux | grep "ai_tools/uwsgi.ini" | grep -v "grep" | wc -l`
if [ $pids -gt 4 ];then
uwsgi --ini $current_path/uwsgi.ini --vhost
echo "uwsgi is running!"
exit 0
else
uwsgi --ini $current_path/uwsgi.ini --vhost
echo "Start uwsgi service [OK]"
fi
;;
stop)
#killall -9 uwsgi
uwsgi --stop /var/run/uwsgi_ai_tools.pid
echo "Stop uwsgi service [OK]"
;;
restart)
uwsgi --reload /var/run/uwsgi_ai_tools.pid
echo "restart uwsgi [OK]"
;;
*)
echo "Usages: sh uwsgiserver.sh [start|stop|restart]"
;;
esac