blob: 5c1b082870514462e26381dccb7c446a0b3facf9 (
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: prometheus_smartctl_exporter
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# prometheus_smartctl_exporter_enable (bool): Set to NO by default.
# Set it to YES to enable prometheus_smartctl_exporter.
# prometheus_smartctl_exporter_user (string): Set user that prometheus_smartctl_exporter will run under
# Default is "nobody".
# prometheus_smartctl_exporter_group (string): Set group that prometheus_smartctl_exporter will run under
# Default is "nobody".
# prometheus_smartctl_exporter_args (string): Set extra arguments to pass to prometheus_smartctl_exporter
# Default is "".
. /etc/rc.subr
name=prometheus_smartctl_exporter
rcvar=prometheus_smartctl_exporter_enable
load_rc_config $name
: ${prometheus_smartctl_exporter_enable:="NO"}
: ${prometheus_smartctl_exporter_user:="root"}
: ${prometheus_smartctl_exporter_group:="operator"}
: ${prometheus_smartctl_exporter_args:=""}
pidfile=/var/run/prometheus-smartctl-exporter.pid
command="/usr/sbin/daemon"
procname="%%PREFIX%%/libexec/prometheus-smartctl-exporter"
command_args="-f -p ${pidfile} -T ${name} \
/usr/bin/env ${procname} \
${prometheus_smartctl_exporter_args}"
start_precmd=prometheus_smartctl_exporter_startprecmd
prometheus_smartctl_exporter_startprecmd()
{
if [ ! -e ${pidfile} ]; then
install \
-o ${prometheus_smartctl_exporter_user} \
-g ${prometheus_smartctl_exporter_group} \
/dev/null ${pidfile};
fi
}
load_rc_config $name
run_rc_command "$1"
|