aboutsummaryrefslogtreecommitdiff
path: root/www/varnish_exporter/files/varnish_exporter.in
blob: a1e600e351aa436dd28d615f0959f63361063fc4 (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
53
54
55
56
57
#!/bin/sh

# PROVIDE: varnish_exporter
# REQUIRE: DAEMON NETWORKING
# KEYWORD: shutdown

#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# varnish_exporter_enable (bool):         Set to NO by default.
#                                         Set it to YES to enable varnish_exporter.
# varnish_exporter_user (string):         Set user that varnish_exporter will run under
#                                         Default is "varnish".
# varnish_exporter_group (string):        Set group that varnish_exporter will run under
#                                         Default is "varnish".
# varnish_exporter_syslog_priority (str): Set to "info" by default.
#                                         Set it to priority to be used by syslog
# varnish_exporter_syslog_facility (str): Set to "daemon" by default.
#                                         Set it to facility to be used by syslog
# varnish_exporter_syslog_tag (str):      Set to "ipfs-go" by default.
#                                         Set it to tag to be used by syslog

. /etc/rc.subr

name=varnish_exporter
rcvar=varnish_exporter_enable

load_rc_config $name

: ${varnish_exporter_enable:="NO"}
: ${varnish_exporter_user:="varnish"}
: ${varnish_exporter_group:="varnish"}
: ${varnish_exporter_syslog_priority:="info"}
: ${varnish_exporter_syslog_facility:="daemon"}
: ${varnish_exporter_syslog_tag:="varnish-exporter"}

pidfile="/var/run/${name}.pid"
command="/usr/sbin/daemon"
procname="%%PREFIX%%/bin/${name}"
command_args="-S -m 3 -s ${varnish_exporter_syslog_priority} -l ${varnish_exporter_syslog_facility} -T ${varnish_exporter_syslog_tag} -p ${pidfile} /usr/bin/env ${procname} ${varnish_exporter_args}"

start_precmd=${name}_startprecmd
extra_commands="reload"

varnish_exporter_startprecmd()
{
    if [ ! -e ${pidfile} ]; then
        install \
            -o ${varnish_exporter_user} \
            -g ${varnish_exporter_group} \
            /dev/null ${pidfile};
    fi
}

load_rc_config $name
run_rc_command "$1"