Last active
August 29, 2015 14:01
-
-
Save mazgi/d4a1d3070d365337b5d7 to your computer and use it in GitHub Desktop.
Fluentd init script for Gentoo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RBENV_VERSION="1.9.3-p545" | |
FLUENTD_EXEC="/var/lib/fluentd/.rbenv/shims/fluentd" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/sbin/runscript | |
# Copyright 1999-2014 Gentoo Foundation | |
# Distributed under the terms of the GNU General Public License v2 | |
# $Header: $ | |
description="Flunetd daemon" | |
FLUENTD_NAME="${SVCNAME##*.}" | |
if [ -n "${FLUENTD_NAME}" -a "${SVCNAME}" != "fluentd" ]; then | |
description="${description} for ${FLUENTD_NAME}" | |
FLUENTD_PID="/var/run/flunetd.${FLUENTD_NAME}.pid" | |
FLUENTD_CONF_DEFAULT="/etc/fluentd/${FLUENTD_NAME}.conf" | |
else | |
FLUENTD_PID="/var/run/flunetd.pid" | |
FLUENTD_CONF_DEFAULT="/etc/fluentd/fluentd.conf" | |
fi | |
FLUENTD_CONF="${FLUENTD_CONF:-${FLUENTD_CONF_DEFAULT}}" | |
FLUENTD_EXEC="${FLUENTD_EXEC:-/opt/fluentd/bin/fluentd}" | |
LD_PRELOAD_OPTS="" | |
if [ -f "/usr/lib64/libjemalloc.so" ]; then | |
LD_PRELOAD_OPTS="/usr/lib64/libjemalloc.so" | |
fi | |
#depend() { | |
#} | |
start() { | |
ebegin "Starting ${SVCNAME}" | |
start-stop-daemon \ | |
--start \ | |
--exec "${FLUENTD_EXEC}" \ | |
--user fluentd \ | |
--background \ | |
--make-pidfile --pidfile "${FLUENTD_PID}" \ | |
--env RBENV_VERSION="${RBENV_VERSION}" \ | |
--env LD_PRELOAD="${LD_PRELOAD_OPTS}" \ | |
-- --config "${FLUENTD_CONF}" --log /var/log/fluentd/fluentd.log -vv | |
eend $? | |
} | |
stop() { | |
ebegin "Stopping ${SVCNAME}" | |
start-stop-daemon --stop --pidfile "${FLUENTD_PID}" | |
eend $? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment