aboutsummaryrefslogtreecommitdiff
path: root/www/py-gunicorn/files/gunicorn.in
blob: f0c995224af2737cc63c95a3fb586ee023d4391f (plain) (blame)
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
#!/bin/sh
#
# PROVIDE: gunicorn
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable gunicorn:
#  gunicorn_enable (bool):    Set to "NO" by default.
#                       Set it to "YES" to enable gunicorn.
#

. /etc/rc.subr

name=gunicorn
rcvar=gunicorn_enable

# set defaults

load_rc_config $name

: ${gunicorn_enable:=NO}
: ${gunicorn_config=%%PREFIX%%/gunicorn/gunicorn.conf.py}
: ${gunicorn_user=%%USERS%%}
: ${gunicorn_group=%%GROUPS%%}

pidfile="/var/run/${name}.pid"
command=/usr/sbin/daemon
command_args="-P ${pidfile} -f -ST ${name} %%PREFIX%%/bin/gunicorn -c ${gunicorn_config}"
required_files="${gunicorn_config}"
start_precmd="gunicorn_precmd"

gunicorn_precmd()
{
	install -o ${gunicorn_user} /dev/null ${pidfile}
}

run_rc_command "$1"