aboutsummaryrefslogtreecommitdiff
path: root/sysutils/rubygem-fluentd/files/fluentd.in
blob: a32b9c6f3aca5cce9ac12f930a7d76ce7f312e0e (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
#!/bin/sh

# PROVIDE: fluentd
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# fluentd_enable (bool):	Set to NO by default.
# 		  		Set it to YES to enable fluentd.
# fluentd_config (path):	Set to %%PREFIX%%/etc/fluentd/fluent.conf
# 		  		by default.
# fluentd_flags (str):          Set to "" by default.

. /etc/rc.subr

name=fluentd
rcvar=fluentd_enable
extra_commands="init"

load_rc_config $name

: ${fluentd_enable:="NO"}
: ${fluentd_config="%%PREFIX%%/etc/fluentd/fluent.conf"}
: ${fluentd_dir="%%PREFIX%%/etc/fluentd"}
: ${fluentd_user="%%USER%%"}
: ${fluentd_group="%%GROUP%%"}
: ${fluentd_flags:=""}

start_precmd="fluentd_start_precmd"

command=%%PREFIX%%/bin/${name}
pidfile=/var/run/${name}/${name}.pid
command_interpreter=%%RUBY%%

command_args="-d $pidfile -c $fluentd_config"

fluentd_start_precmd()
{
    install -d -o ${fluentd_user} -g ${fluentd_group} -m 775 ${fluentd_dir}
    install -d -o ${fluentd_user} -g ${fluentd_group} -m 775 /var/run/fluentd
}

run_rc_command "$1"