summaryrefslogtreecommitdiff
path: root/app-admin/logstash-forwarder
diff options
context:
space:
mode:
authorAmadeusz Żołnowski <aidecoe@gentoo.org>2015-08-15 11:57:13 +0059
committerAmadeusz Żołnowski <aidecoe@gentoo.org>2015-08-15 14:01:25 +0059
commit8ff07efe8002a7ee0545cac58e6ec9a78c7481d6 (patch)
tree08883973f249970964d991f15ff239c2b1c4222a /app-admin/logstash-forwarder
parentd6c13e9d9ad4c9fa3133f31f5d4e726e159ce4ab (diff)
downloadgentoo-8ff07efe8002a7ee0545cac58e6ec9a78c7481d6.tar.gz
gentoo-8ff07efe8002a7ee0545cac58e6ec9a78c7481d6.tar.xz
app-admin/logstash-forwarder: Keep state at constant path
At every service start initd script used to create random temporary directory for keeping state, but as of reasons explained in bug #557530 it's better to keep it constant. Gentoo-Bug: 557530 Package-Manager: portage-2.2.20
Diffstat (limited to 'app-admin/logstash-forwarder')
-rw-r--r--app-admin/logstash-forwarder/files/logstash-forwarder.initd40
-rw-r--r--app-admin/logstash-forwarder/logstash-forwarder-0.4.0.ebuild5
2 files changed, 9 insertions, 36 deletions
diff --git a/app-admin/logstash-forwarder/files/logstash-forwarder.initd b/app-admin/logstash-forwarder/files/logstash-forwarder.initd
index 38e09b65ab6..263ea8c7bd0 100644
--- a/app-admin/logstash-forwarder/files/logstash-forwarder.initd
+++ b/app-admin/logstash-forwarder/files/logstash-forwarder.initd
@@ -3,47 +3,19 @@
# Distributed under the terms of the GNU General Public License v2
# $Id$
-create_tmpdir() {
- local tmpdir="$(mktemp -d -p /tmp logstash-forwarder.XXXXXXXXXX)"
-
- chown logstash:logstash "${tmpdir}" || return 1
- chmod 0750 "${tmpdir}" || return 1
-
- echo "${tmpdir}"
-}
-
-remove_tmpdir() {
- local d=''
- local tmpdir=''
-
- for d in /tmp/logstash-forwarder.??????????; do
- [[ -e ${d} ]] || return 0
- [[ -d ${d} ]] || continue
-
- if ! [[ ${tmpdir} ]]; then
- tmpdir="${d}"
- else
- # There are more directories like that, so better keep them all.
- return 1
- fi
- done
-
- rm -r "${tmpdir}"
-}
-
start() {
local config_file=/etc/logstash-forwarder/logstash-forwarder.conf
- local tmpdir="$(create_tmpdir)"
+ local statedir=/var/lib/logstash-forwarder
- if ! [[ -d ${tmpdir} ]]; then
- eend 1 "Failed to create tmp directory for logstash-forwarder"
+ if ! [[ -d ${statedir} ]]; then
+ eend 1 "logstash state directory is missing: ${statedir}"
return 1
fi
ebegin "Starting logstash-forwarder"
start-stop-daemon --start --exec /usr/bin/logstash-forwarder \
--make-pidfile --pidfile /run/logstash-forwarder.pid \
- --background --wait 100 --chdir "${tmpdir}" \
+ --background --wait 100 --chdir "${statedir}" \
--user logstash --group logstash \
-- -config="${config_file}" ${LOGSTASH_FORWARDER_ARGS}
eend $?
@@ -55,9 +27,5 @@ stop() {
--pidfile /run/logstash-forwarder.pid --user logstash --group logstash
local rc=$?
- if ! remove_tmpdir; then
- ewarn "Failed to remove logstash-forwarder tmp directory"
- fi
-
eend ${rc}
}
diff --git a/app-admin/logstash-forwarder/logstash-forwarder-0.4.0.ebuild b/app-admin/logstash-forwarder/logstash-forwarder-0.4.0.ebuild
index fda913602fc..a9dbce544f4 100644
--- a/app-admin/logstash-forwarder/logstash-forwarder-0.4.0.ebuild
+++ b/app-admin/logstash-forwarder/logstash-forwarder-0.4.0.ebuild
@@ -29,6 +29,11 @@ src_install() {
dodoc "${PN}".conf.example CHANGELOG README.md
newconfd "${FILESDIR}/${PN}.confd" "${PN}"
newinitd "${FILESDIR}/${PN}.initd" "${PN}"
+
+ local statedir="/var/lib/${PN}"
+ keepdir "$statedir"
+ fowners logstash:logstash "$statedir"
+ fperms 0750 "$statedir"
}
pkg_postinst() {