-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathuwsgi_service-redhat.erb
More file actions
113 lines (95 loc) · 2 KB
/
uwsgi_service-redhat.erb
File metadata and controls
113 lines (95 loc) · 2 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/sh
# This file is managed by puppet class 'uwsgi'
#
# uWSGI Emperor process init.d script
#
# chkconfig: - 85 15
# description: uWSGI Emperor process init.d script
### BEGIN INIT INFO
# Provides: uwsgi
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop uwsgi
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
UWSGILOG="<%= @log_file %>"
UWSGIPID="<%= @pidfile %>"
UWSGISOCKET="<%= @socket %>"
OPTIONS="--ini <%= @config_file %>"
UWSGILOGDIR="${UWSGILOG%/*}"
UWSGIPIDDIR="${UWSGIPID%/*}"
UWSGISOCKETDIR="${UWSGISOCKET%/*}"
UWSGICONFDIR="<%= @app_directory %>"
[ -f /etc/sysconfig/uwsgi ] && . /etc/sysconfig/uwsgi
if [ ! -d "${UWSGILOGDIR}" ]; then
mkdir -p "${UWSGILOGDIR}"
[ -n "${RUNAS}" ] && chown "${RUNAS}:" "${UWSGILOGDIR}"
fi
if [ ! -d "${UWSGIPIDDIR}" ]; then
mkdir -p "${UWSGIPIDDIR}"
[ -n "${RUNAS}" ] && chown "${RUNAS}:" "${UWSGIPIDDIR}"
fi
if [ ! -d "${UWSGISOCKETDIR}" ]; then
mkdir -p "${UWSGISOCKETDIR}"
[ -n "${RUNAS}" ] && chown "${RUNAS}:" "${UWSGISOCKETDIR}"
fi
if [ ! -d "${UWSGICONFDIR}" ]; then
mkdir -p "${UWSGICONFDIR}"
[ -n "${RUNAS}" ] && chown "${RUNAS}:" "${UWSGICONFDIR}"
fi
RETVAL=0
prog=uwsgi
lockfile=/var/lock/subsys/$prog
start() {
[ "$EUID" != "0" ] && exit 4
# Start daemons.
echo -n $"Starting $prog: "
daemon $prog $OPTIONS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $lockfile
return $RETVAL
}
stop() {
[ "$EUID" != "0" ] && exit 4
echo -n $"Shutting down $prog: "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $lockfile
return $RETVAL
}
reload() {
[ "$EUID" != "0" ] && exit 4
echo -n $"Reloading $prog: "
killproc $prog -HUP
RETVAL=$?
echo
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $prog
;;
restart)
stop
start
;;
reload)
reload
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload}"
exit 2
;;
esac
exit $?