uwsgi-DEB-dist
1.8 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
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
### BEGIN INIT INFO
# Provides: uwsgi
# Required-Start: $network $remote_fs $local_fs
# Required-Stop: $network $remote_fs $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Use uwsgi to run python and wsgi web apps.
### END INIT INFO
PATH=/opt/uwsgi:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON="<UWSGI_VE32_PATH>/bin/uwsgi"
NAME=uwsgi
DESC=uwsgi
test -x $DAEMON || exit 0
# Include uwsgi defaults if available.
if [ -f /etc/default/uwsgi ] ; then
. /etc/default/uwsgi
fi
set -e
DAEMON_OPTS="--ini <UWSGI_VE32_PATH>/src/uWSGI/production.ini"
case "$1" in
start)
echo -n "Starting $DESC: "
sleep 2
start-stop-daemon --start --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --signal 3 --retry 2 --stop \
--exec $DAEMON
echo "$NAME."
;;
restart)
echo -n "Restarting $DESC: "
# NOTE: O comando "set +e" é necessário para que caso o serviço já
# esteja parado o comando "start-stop-daemon" não faça o script de
# inicialização parar! By Questor
set +e
start-stop-daemon --signal 3 --retry 2 --stop \
--exec $DAEMON
RETVAL="$?"
# RETVAL:
# 0 if daemon has been stopped;
# 1 if daemon was already stopped;
# 2 if daemon could not be stopped;
# other if a failure occurred.
if [ ${RETVAL} -eq 0 ] || [ ${RETVAL} -eq 1 ] ; then
sleep 1
start-stop-daemon --start --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
fi
;;
status)
killall -10 $DAEMON
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|status}" >&2
exit 1
;;
esac
exit 0