Skip to content

Commit

Permalink
app-admin/logstash-bin: Add reload to init script #579032
Browse files Browse the repository at this point in the history
Package-Manager: portage-2.2.28
  • Loading branch information
patricklauer committed Apr 5, 2016
1 parent b32a257 commit 1c0fb63
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
65 changes: 65 additions & 0 deletions app-admin/logstash-bin/files/logstash.initd-r2
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/sbin/openrc-run
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

LS_USER=${LS_USER:-logstash}
LS_GROUP=${LS_GROUP:-$LS_USER}
LS_LOG_FILE=${LS_LOG_FILE:-/var/log/logstash/logstash.log}
LS_CONF_DIR=${LS_CONF_DIR:-/etc/logstash/conf.d}
LS_HOME=${LS_HOME:-/var/lib/logstash}
LS_HEAP_SIZE=${LS_HEAP_SIZE:-500m}
LS_NICE=${LS_NICE:-19}
LS_JAVA_OPTS=${LS_JAVA_OPTS:-"-Djava.io.tmpdir=${LS_HOME}"}
LS_USE_GC_LOGGING=${LS_USE_GC_LOGGING:-false}
LS_OPEN_FILES=${LS_OPEN_FILES:-16384}
KILL_ON_STOP_TIMEOUT=${KILL_ON_STOP_TIMEOUT:-0}

command="/opt/logstash/bin/logstash"
command_args="agent --config ${LS_CONF_DIR} --log ${LS_LOG_FILE} ${LS_OPTS}"
command_background="true"
pidfile=${LS_PIDFILE:-"/run/logstash/logstash.pid"}

start_stop_daemon_args="--user ${LS_USER}:${LS_GROUP} \
--chdir ${LS_HOME}
--nicelevel ${LS_NICE}
--env LS_HEAP_SIZE=${LS_HEAP_SIZE}
--env LS_JAVA_OPTS=${LS_JAVA_OPTS}
--env LS_USE_GC_LOGGING=${LS_USE_GC_LOGGING}"

extra_commands="checkconfig"
extra_started_commands="reload"

checkconfig() {
ebegin "Checking your configuration"
${command} ${command_args} --configtest
eend $? "Configuration error. Please fix your configuration files."
}

reload() {
checkconfig || return 1
ebegin "Reloading configuration"
start-stop-daemon --signal HUP --pidfile "${pidfile}"
eend $?
}

start_pre() {
checkconfig || return 1

rc_ulimit="-n ${LS_OPEN_FILES}"

checkpath -d -o "${LS_USER}":"${LS_GROUP}" -m750 "$(dirname "${pidfile}")"
checkpath -d -o "${LS_USER}":"${LS_GROUP}" -m750 "$(dirname "${LS_LOG_FILE}")"
checkpath -f -o "${LS_USER}":"${LS_GROUP}" -m640 "${LS_LOG_FILE}"
}

stop() {
ebegin "Stopping logstash"
if [ "${KILL_ON_STOP_TIMEOUT}" == "1" ]; then
start-stop-daemon --stop \
--pidfile=${pidfile} \
--retry=TERM/5/KILL/5
else
start-stop-daemon --stop \
--pidfile=${pidfile}
fi
}
2 changes: 1 addition & 1 deletion app-admin/logstash-bin/logstash-bin-2.3.0-r1.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ src_install() {
newins "${FILESDIR}/${MY_PN}.logrotate-r2" "${MY_PN}"

newconfd "${FILESDIR}/${MY_PN}.confd-r1" "${MY_PN}"
newinitd "${FILESDIR}/${MY_PN}.initd-r1" "${MY_PN}"
newinitd "${FILESDIR}/${MY_PN}.initd-r2" "${MY_PN}"
}

pkg_postinst() {
Expand Down

0 comments on commit 1c0fb63

Please sign in to comment.