uwsgi_for_flask
1.33 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh
### BEGIN INIT INFO
# Provides: uwsgi-emperor
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the uwsgi emperor app server
# Description: starts uwsgi app server using start-stop-daemon
### END INIT INFO
#
# modified from https://gist.github.com/asmallteapot/1633492#file-init_uwsgi-sh
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/bin/uwsgi
NAME=uwsgi-emperor
DESC=uwsgi-emperor
# modify as needed
VASALS=/opt/open-hackathon/nginx_openhackathon.uwsgi.ini
EMPEROR_LOGS=/var/log/uwsgi/*.log
test -x $DAEMON || exit 0
# Include uwsgi defaults if available
if [ -f /etc/default/uwsgi ] ; then
. /etc/default/uwsgi
fi
set -e
DAEMON_OPTS="--emperor $VASALS --die-on-term --master --daemonize $EMPEROR_LOGS"
case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon --start --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --signal 3 --quiet --retry 2 --stop \
--exec $DAEMON
echo "$NAME."
;;
status)
ps -ef | grep uwsgi
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|status}" >&2
exit 1
;;
esac
exit 0