aboutsummaryrefslogtreecommitdiffstats
path: root/testing/logstash/logstash.initd
diff options
context:
space:
mode:
authorStuart Cardall <developer@it-offshore.co.uk>2017-03-08 22:55:10 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2017-03-24 21:08:03 +0000
commit70516d0b4500df3e14c8d41d6d8b7ecc62c74618 (patch)
tree64ad8f5ba6468cc508e6cf35c2c7261799ba15fc /testing/logstash/logstash.initd
parent6dec91f48cc6136107985cc444729f4d2295e6f1 (diff)
downloadaports-70516d0b4500df3e14c8d41d6d8b7ecc62c74618.tar.bz2
aports-70516d0b4500df3e14c8d41d6d8b7ecc62c74618.tar.xz
testing/logstash: update to 5.2.2 / use supervise-daemon
adds service supervision with OpenRC's builtin supervise-daemon logstash/bin added to $PATH take ownership
Diffstat (limited to 'testing/logstash/logstash.initd')
-rw-r--r--testing/logstash/logstash.initd52
1 files changed, 35 insertions, 17 deletions
diff --git a/testing/logstash/logstash.initd b/testing/logstash/logstash.initd
index e7e8ed7a2c..b022fd387b 100644
--- a/testing/logstash/logstash.initd
+++ b/testing/logstash/logstash.initd
@@ -1,25 +1,43 @@
-#!/sbin/runscript
+#!/sbin/openrc-run
+supervisor=supervise-daemon
+
+description="logs, events, or other data transporter"
+
+: ${LS_USER:="logstash"}
+: ${LS_GROUP:="$(id -gn $LS_USER)"}
+
+nice="19"
+pidfile="/run/$RC_SVCNAME.sd.pid"
+supervise_daemon_args="-u $LS_USER -g $LS_GROUP -p $pidfile -N $nice"
+command=/usr/share/logstash/bin/logstash
+command_args="--path.settings ${LS_CONF} ${LS_OPTS}"
+max_fd="16384"
depends() {
- needs network
- provide logstash
+ use net
}
-description="logstash"
-command="/usr/share/logstash/bin/logstash"
-pidfile="/var/run/logstash/logstash.pid"
-start_stop_daemon_args="--user logstash"
-command_args="${LS_OPTS}"
+in_contr() {
+ grep "container=" /proc/1/environ
+}
start_pre() {
- checkpath --owner logstash:daemon --directory ${pidfile%/*}
-}
+ local dir
-start() {
- ebegin "Starting logstash"
- start-stop-daemon $start_stop_daemon_args --background --start --exec \
- $command --make-pidfile --pidfile $pidfile -- $command_args
- eend $?
-}
+ # Note: checkpath doesn't create intermediate directories.
+ for dir in "${LS_HOME}" "${LS_DATA}" "${LS_LOGS}"; do
+ mkdir -p "$(dirname "$dir")"
+ done
-# uses the openrc templates for start()/stop()
+ checkpath -d -o $LS_USER:$LS_GROUP -m755 "${LS_HOME}"
+ checkpath -d -o $LS_USER:$LS_GROUP -m700 "${LS_DATA}"
+ checkpath -d -o $LS_USER:$LS_GROUP -m755 "${LS_LOGS}"
+
+ if [ -n "$max_fd" ]; then
+ if [ -z "$(in_contr)" ]; then
+ ulimit -n "$max_fd" && einfo "Max open filedescriptors: $max_fd"
+ else
+ einfo "Run 'ulimit -n $max_fd' on the container host"
+ fi
+ fi
+}