blob: 99e2b2037219fd644e4e4e5193b7df427eb47235 (
plain)
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
|
#!/bin/sh
# $FreeBSD$
# PROVIDE: nfs_exporter
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# nfs_exporter_enable (bool): Set to NO by default.
# Set it to YES to enable nfs-exporter.
# nfs_exporter_args (string): Set extra arguments to pass to nfs-exporter
# Default is "".
# nfs_exporter_user (string): Set user that nfs_exporter will run under
# Default is "root".
# nfs_exporter_group (string): Set group that nfs_exporter will run under
# Default is "wheel".
. /etc/rc.subr
name=nfs_exporter
desc="NFS prometheus exporter"
rcvar=nfs_exporter_enable
load_rc_config $name
: ${nfs_exporter_enable:=NO}
: ${nfs_exporter_args:=""}
: ${nfs_exporter_user:=root}
: ${nfs_exporter_group:=wheel}
pidfile=/var/run/nfs_exporter.pid
command=/usr/sbin/daemon
procname=%%PREFIX%%/bin/nfs-exporter
command_args="-f -p ${pidfile} /usr/bin/env ${procname} ${nfs_exporter_args}"
start_precmd=nfs_exporter_startprecmd
nfs_exporter_startprecmd()
{
if [ -e ${pidfile} ]; then
chown ${nfs_exporter_user}:${nfs_exporter_group} ${pidfile};
else
install -o ${nfs_exporter_user} -g ${nfs_exporter_group} /dev/null ${pidfile};
fi
}
run_rc_command "$1"
|