You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.8 KiB
62 lines
1.8 KiB
7 years ago
|
#!@l_prefix@/bin/openpkg rc
|
||
|
##
|
||
|
## rc.fluentd -- Run-Commands
|
||
|
##
|
||
|
|
||
|
%config
|
||
|
fluentd_enable="$openpkg_rc_def"
|
||
|
fluentd_flags=""
|
||
|
fluentd_log_prolog="true"
|
||
|
fluentd_log_epilog="true"
|
||
|
fluentd_log_numfiles="10"
|
||
|
fluentd_log_minsize="1M"
|
||
|
fluentd_log_complevel="9"
|
||
|
|
||
|
%common
|
||
|
fluentd_cfgfile="@l_prefix@/etc/fluentd/fluentd.conf"
|
||
|
fluentd_pidfile="@l_prefix@/var/fluentd/run/fluentd.pid"
|
||
|
fluentd_logfile="@l_prefix@/var/fluentd/log/fluentd.log"
|
||
|
fluentd_signal () {
|
||
|
[ -f $fluentd_pidfile ] && kill -$1 `cat $fluentd_pidfile`
|
||
|
}
|
||
|
|
||
|
%status -u @l_rusr@ -o
|
||
|
fluentd_usable="unknown"
|
||
|
fluentd_active="no"
|
||
|
rcService fluentd enable yes && \
|
||
|
fluentd_signal 0 && fluentd_active="yes"
|
||
|
echo "fluentd_enable=\"$fluentd_enable\""
|
||
|
echo "fluentd_usable=\"$fluentd_usable\""
|
||
|
echo "fluentd_active=\"$fluentd_active\""
|
||
|
|
||
|
%start -u @l_rusr@
|
||
|
rcService fluentd enable yes || exit 0
|
||
|
rcService fluentd active yes && exit 0
|
||
|
( nohup @l_prefix@/bin/fluentd $fluentd_flags \
|
||
|
-c $fluentd_cfgfile \
|
||
|
</dev/null >>$fluentd_logfile 2>&1 &
|
||
|
echo $! >$fluentd_pidfile
|
||
|
) >/dev/null 2>&1
|
||
|
|
||
|
%stop -u @l_rusr@
|
||
|
rcService fluentd enable yes || exit 0
|
||
|
rcService fluentd active no && exit 0
|
||
|
fluentd_signal TERM
|
||
|
sleep 2
|
||
|
rm -f $fluentd_pidfile >/dev/null 2>&1 || true
|
||
|
|
||
|
%restart -u @l_rusr@
|
||
|
rcService fluentd enable yes || exit 0
|
||
|
rcService fluentd active no && exit 0
|
||
|
rc fluentd stop start
|
||
|
|
||
|
%daily -u @l_susr@
|
||
|
rcService fluentd enable yes || exit 0
|
||
|
shtool rotate -f \
|
||
|
-n $fluentd_log_numfiles -s $fluentd_log_minsize -d \
|
||
|
-z $fluentd_log_complevel -m 664 -o @l_rusr@ -g @l_rgrp@ \
|
||
|
-P "$fluentd_log_prolog" \
|
||
|
-E "$fluentd_log_epilog; rc fluentd reload" \
|
||
|
$fluentd_logfile
|
||
|
|