blob: 3ba9676126a8a42f201591bf817760f703114cb8 (
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
|
#!/bin/sh
# PROVIDE: prometheus_postgresql_adapter
# REQUIRE: DAEMON NETWORKING
# BEFORE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# prometheus_postgresql_adapter_enable (bool): Set to NO by default.
# Set it to YES to enable adapter.
# prometheus_postgresql_adapter_flags (string): Set to "" by default.
#
# prometheus_postgresql_adapter_facility (str): Syslog facility to use
# Default: daemon
# prometheus_postgresql_adapter_priority (str): Syslog priority to use
# Default: info
. /etc/rc.subr
name=prometheus_postgresql_adapter
rcvar=prometheus_postgresql_adapter_enable
load_rc_config $name
prometheus_postgresql_adapter_flags=${prometheus_postgresql_adapter_flags:-"-log-level warn"}
: ${prometheus_postgresql_adapter_enable:=NO}
: ${prometheus_postgresql_adapter_facility:=daemon}
: ${prometheus_postgresql_adapter_priority:=info}
# daemon
procname="%%PREFIX%%/bin/prometheus-postgresql-adapter"
command=/usr/sbin/daemon
pidfile="/var/run/${name}.pid"
start_cmd="prometheus_postgresql_adapter_startcmd"
prometheus_postgresql_adapter_startcmd()
{
echo "Starting ${name}."
/usr/sbin/daemon -c -p ${pidfile} /bin/sh -c "${procname} ${prometheus_postgresql_adapter_flags} 2>&1 \
| /usr/bin/logger -t ${name} -p ${prometheus_postgresql_adapter_facility}.${prometheus_postgresql_adapter_priority}"
}
run_rc_command "$1"
|