summaryrefslogtreecommitdiff
path: root/www/nginx-vts-exporter/files/nginx_vts_exporter.in
blob: 735d89ed61be3445cb0c8d875c4a38e49c0083e9 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh

# PROVIDE: nginx_vts_exporter
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# nginx_vts_exporter_enable (bool):     Set to NO by default
#                                       Set it to YES to enable nginx-vts-exporter
# nginx_vts_exporter_user (string):     Set user to run nginx-vts-exporter
#                                       Default is "nobody"
# nginx_vts_exporter_group (string):    Set group to run nginx-vts-exporter
#                                       Default is "nobody"
# nginx_vts_exporter_args (string):     Set additional command line arguments
#                                       Default is ""
#

. /etc/rc.subr

name=nginx_vts_exporter
rcvar=nginx_vts_exporter_enable

load_rc_config $name

: ${nginx_vts_exporter_enable:="NO"}
: ${nginx_vts_exporter_user:="nobody"}
: ${nginx_vts_exporter_group:="nobody"}
: ${nginx_vts_exporter_args:=""}

pidfile="/var/run/${name}.pid"
command="/usr/sbin/daemon"
procname="%%PREFIX%%/bin/${name}"
command_args="-p ${pidfile} -m 3 -T ${name} \
                /usr/bin/env ${procname} \
                ${nginx_vts_exporter_args}"

start_precmd=nginx_vts_exporter_startprecmd

nginx_vts_exporter_startprecmd()
{
    if [ ! -e ${pidfile} ]; then
        install \
            -o ${nginx_vts_exporter_user} \
            -g ${nginx_vts_exporter_group} \
            /dev/null ${pidfile};
    fi
}

load_rc_config $name
run_rc_command "$1"