summaryrefslogtreecommitdiff
path: root/sysutils/sensu-go/files/sensu-agent.in
blob: 87204142144920877d5c572ee1e7e7ec2ec3d281 (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
#!/bin/sh

# PROVIDE: sensu-agent
# REQUIRE: LOGIN
# KEYWORD: shutdown

# Add the following lines to /etc/rc.conf to enable sensu-agent:
#
# sensu_agent_enable (bool):	Set to YES to enable sensu-agent
# 				Default: NO
# sensu_agent_config (str):	sensu-agent configuration file
#				Default: ${PREFIX}/etc/sensu-agent.yml

. /etc/rc.subr

name=sensu_agent
rcvar=sensu_agent_enable

load_rc_config ${name}

: ${sensu_agent_enable:="NO"}
: ${sensu_agent_config:="%%PREFIX%%/etc/sensu-agent.yml"}
: ${sensu_agent_restart_delay:="10"}

pidfile="/var/run/sensu-agent.pid"
command=/usr/sbin/daemon
sensu_agent_command=%%PREFIX%%/bin/sensu-agent
command_args="-rP ${pidfile} -S -R ${sensu_agent_restart_delay} \
    -T ${name} ${sensu_agent_command} \
    start -c ${sensu_agent_config}"

load_rc_config $name
run_rc_command "$1"