#!/bin/sh # $FreeBSD: head/sysutils/rubygem-fluentd/files/fluentd.in 366153 2014-08-25 21:16:56Z swills $ # # 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:=""} PATH="${PATH}:/usr/local/bin" # for rbenv... export RBENV_ROOT="/usr/local/rbenv" export PATH="${RBENV_ROOT}/bin:${PATH}" eval "$(rbenv init -)" start_precmd="fluentd_start_precmd" command=/usr/local/rbenv/shims/${name} pidfile=/var/run/${name}/${name}.pid #command_interpreter="/usr/local/rbenv/shims/ruby" stop_cmd='pkill -f fluentd' 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"