public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Ian Delaney" <idella4@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: app-misc/elasticsearch/files/
Date: Thu, 17 Dec 2015 13:59:12 +0000 (UTC)	[thread overview]
Message-ID: <1450360738.1a0ea0914d676d18ddc19c8f7b48cd6c22f68cf9.idella4@gentoo> (raw)

commit:     1a0ea0914d676d18ddc19c8f7b48cd6c22f68cf9
Author:     Ian Delaney <idella4 <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 17 13:56:10 2015 +0000
Commit:     Ian Delaney <idella4 <AT> gentoo <DOT> org>
CommitDate: Thu Dec 17 13:58:58 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1a0ea091

app-misc/elasticsearch: switch to correct file elasticsearch.init5

file mistakenly mixed with ".service5", now obsoleted in the gentoo bug

Gentoo bug: 564604

Package-Manager: portage-2.2.24

 app-misc/elasticsearch/files/elasticsearch.init4 |  2 +-
 app-misc/elasticsearch/files/elasticsearch.init5 | 94 +++++++++++++++++++++---
 2 files changed, 86 insertions(+), 10 deletions(-)

diff --git a/app-misc/elasticsearch/files/elasticsearch.init4 b/app-misc/elasticsearch/files/elasticsearch.init4
index 7110e58..4ba42f6 100644
--- a/app-misc/elasticsearch/files/elasticsearch.init4
+++ b/app-misc/elasticsearch/files/elasticsearch.init4
@@ -67,7 +67,7 @@ start() {
 	checkpath -d -o "${ES_USER}" -m750 "$(dirname "${PIDFILE}")"
 	checkpath -d -o "${ES_USER}" -m750 "${ES_BASE_PATH}"
 	checkpath -d -o "${ES_USER}" -m750 "${ES_LOG_PATH}"
-	
+
 	start-stop-daemon --start \
 		--background \
 		--chdir "${ES_BASE_PATH}" \

diff --git a/app-misc/elasticsearch/files/elasticsearch.init5 b/app-misc/elasticsearch/files/elasticsearch.init5
index 739c6f8..a7fb185 100644
--- a/app-misc/elasticsearch/files/elasticsearch.init5
+++ b/app-misc/elasticsearch/files/elasticsearch.init5
@@ -1,11 +1,87 @@
-[Unit]
-Description=Elasticsearch
-After=network.target
+#!/sbin/runscript
 
-[Service]
-User=elasticsearch
-Environment=ES_INCLUDE=/usr/share/elasticsearch/bin/elasticsearch.in.sh
-ExecStart=/usr/share/elasticsearch/bin/elasticsearch -Des.default.path.conf=/etc/elasticsearch
+name="Elasticsearch"
+description=""
 
-[Install]
-WantedBy=multi-user.target
+ES_USER=${ES_USER:="elasticsearch"}
+ES_INSTANCE=${SVCNAME#*.}
+
+if [ -n "${ES_INSTANCE}" ] && [ ${SVCNAME} != "elasticsearch" ]; then
+	PIDFILE="/run/elasticsearch/elasticsearch.${ES_INSTANCE}.pid"
+	ES_BASE_PATH="/var/lib/elasticsearch/${ES_INSTANCE}"
+	ES_CONF_PATH="/etc/elasticsearch/${ES_INSTANCE}"
+	ES_LOG_PATH="/var/log/elasticsearch/${ES_INSTANCE}"
+else
+	PIDFILE="/run/elasticsearch/elasticsearch.pid"
+	ES_BASE_PATH="/var/lib/elasticsearch/_default"
+	ES_CONF_PATH="/etc/elasticsearch"
+	ES_LOG_PATH="/var/log/elasticsearch/_default"
+fi
+
+ES_DATA_PATH="${ES_BASE_PATH}/data"
+ES_WORK_PATH="${ES_BASE_PATH}/work"
+
+export ES_INCLUDE="/usr/share/elasticsearch/bin/elasticsearch.in.sh"
+export JAVA_OPTS
+export ES_JAVA_OPTS
+export ES_HEAP_SIZE
+export ES_HEAP_NEWSIZE
+export ES_DIRECT_SIZE
+export ES_USE_IPV4
+
+server_command="/usr/share/elasticsearch/bin/elasticsearch"
+server_args=" -p ${PIDFILE} -Des.default.path.conf=${ES_CONF_PATH} -Des.default.path.data=${ES_DATA_PATH} -Des.default.path.work=${ES_WORK_PATH} -Des.default.path.logs=${ES_LOG_PATH}"
+
+depend() {
+	use net
+}
+
+start() {
+	# elasticsearch -Des.config=/path/to/config/file
+	# elasticsearch -Des.network.host=10.0.0.4
+
+	[ ! -f "${ES_INCLUDE}" ] && {
+		eerror "${ES_INCLUDE} must be copied into place"
+		return 1
+	}
+
+	local conf
+	local conf_file
+	for conf in elasticsearch.yml logging.yml; do
+		conf_file="${ES_CONF_PATH}/${conf}"
+		if [ ! -f "${conf_file}" ]; then
+			eerror "${conf_file} must be copied into place"
+			return 1
+		fi
+	done
+
+	ebegin "Starting ${SVCNAME}"
+
+	if [ -n "${ES_MAX_FD}" ]; then
+		ulimit -n ${ES_MAX_FD}
+		einfo "Max open filedescriptors  : ${ES_MAX_FD}"
+	fi
+
+	checkpath -d -o "${ES_USER}" -m750 "/var/lib/elasticsearch"
+	checkpath -d -o "${ES_USER}" -m750 "/var/log/elasticsearch"
+	checkpath -d -o "${ES_USER}" -m750 "$(dirname "${PIDFILE}")"
+	checkpath -d -o "${ES_USER}" -m750 "${ES_BASE_PATH}"
+	checkpath -d -o "${ES_USER}" -m750 "${ES_LOG_PATH}"
+
+	start-stop-daemon --start \
+		--background \
+		--chdir "${ES_BASE_PATH}" \
+		--user="${ES_USER}" \
+		--pidfile="${PIDFILE}" \
+		--exec ${server_command} -- ${server_args}
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping ${SVCNAME}"
+	start-stop-daemon --stop \
+		--pidfile=${PIDFILE} \
+		--user="${ES_USER}" \
+		--retry=TERM/20/KILL/5
+	eend $?
+}


             reply	other threads:[~2015-12-17 13:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-17 13:59 Ian Delaney [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-06-30 12:55 [gentoo-commits] repo/gentoo:master commit in: app-misc/elasticsearch/files/ Florian Schmaus
2021-06-20  7:44 Joonas Niilola
2019-09-19  9:01 Michał Górny
2018-09-22  7:07 Michał Górny
2018-05-25 13:14 Aaron Bauman
2017-11-05 15:37 Patrice Clement
2015-12-16 11:22 Ian Delaney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450360738.1a0ea0914d676d18ddc19c8f7b48cd6c22f68cf9.idella4@gentoo \
    --to=idella4@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox