1 |
commit: 1a0ea0914d676d18ddc19c8f7b48cd6c22f68cf9 |
2 |
Author: Ian Delaney <idella4 <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Dec 17 13:56:10 2015 +0000 |
4 |
Commit: Ian Delaney <idella4 <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Dec 17 13:58:58 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1a0ea091 |
7 |
|
8 |
app-misc/elasticsearch: switch to correct file elasticsearch.init5 |
9 |
|
10 |
file mistakenly mixed with ".service5", now obsoleted in the gentoo bug |
11 |
|
12 |
Gentoo bug: 564604 |
13 |
|
14 |
Package-Manager: portage-2.2.24 |
15 |
|
16 |
app-misc/elasticsearch/files/elasticsearch.init4 | 2 +- |
17 |
app-misc/elasticsearch/files/elasticsearch.init5 | 94 +++++++++++++++++++++--- |
18 |
2 files changed, 86 insertions(+), 10 deletions(-) |
19 |
|
20 |
diff --git a/app-misc/elasticsearch/files/elasticsearch.init4 b/app-misc/elasticsearch/files/elasticsearch.init4 |
21 |
index 7110e58..4ba42f6 100644 |
22 |
--- a/app-misc/elasticsearch/files/elasticsearch.init4 |
23 |
+++ b/app-misc/elasticsearch/files/elasticsearch.init4 |
24 |
@@ -67,7 +67,7 @@ start() { |
25 |
checkpath -d -o "${ES_USER}" -m750 "$(dirname "${PIDFILE}")" |
26 |
checkpath -d -o "${ES_USER}" -m750 "${ES_BASE_PATH}" |
27 |
checkpath -d -o "${ES_USER}" -m750 "${ES_LOG_PATH}" |
28 |
- |
29 |
+ |
30 |
start-stop-daemon --start \ |
31 |
--background \ |
32 |
--chdir "${ES_BASE_PATH}" \ |
33 |
|
34 |
diff --git a/app-misc/elasticsearch/files/elasticsearch.init5 b/app-misc/elasticsearch/files/elasticsearch.init5 |
35 |
index 739c6f8..a7fb185 100644 |
36 |
--- a/app-misc/elasticsearch/files/elasticsearch.init5 |
37 |
+++ b/app-misc/elasticsearch/files/elasticsearch.init5 |
38 |
@@ -1,11 +1,87 @@ |
39 |
-[Unit] |
40 |
-Description=Elasticsearch |
41 |
-After=network.target |
42 |
+#!/sbin/runscript |
43 |
|
44 |
-[Service] |
45 |
-User=elasticsearch |
46 |
-Environment=ES_INCLUDE=/usr/share/elasticsearch/bin/elasticsearch.in.sh |
47 |
-ExecStart=/usr/share/elasticsearch/bin/elasticsearch -Des.default.path.conf=/etc/elasticsearch |
48 |
+name="Elasticsearch" |
49 |
+description="" |
50 |
|
51 |
-[Install] |
52 |
-WantedBy=multi-user.target |
53 |
+ES_USER=${ES_USER:="elasticsearch"} |
54 |
+ES_INSTANCE=${SVCNAME#*.} |
55 |
+ |
56 |
+if [ -n "${ES_INSTANCE}" ] && [ ${SVCNAME} != "elasticsearch" ]; then |
57 |
+ PIDFILE="/run/elasticsearch/elasticsearch.${ES_INSTANCE}.pid" |
58 |
+ ES_BASE_PATH="/var/lib/elasticsearch/${ES_INSTANCE}" |
59 |
+ ES_CONF_PATH="/etc/elasticsearch/${ES_INSTANCE}" |
60 |
+ ES_LOG_PATH="/var/log/elasticsearch/${ES_INSTANCE}" |
61 |
+else |
62 |
+ PIDFILE="/run/elasticsearch/elasticsearch.pid" |
63 |
+ ES_BASE_PATH="/var/lib/elasticsearch/_default" |
64 |
+ ES_CONF_PATH="/etc/elasticsearch" |
65 |
+ ES_LOG_PATH="/var/log/elasticsearch/_default" |
66 |
+fi |
67 |
+ |
68 |
+ES_DATA_PATH="${ES_BASE_PATH}/data" |
69 |
+ES_WORK_PATH="${ES_BASE_PATH}/work" |
70 |
+ |
71 |
+export ES_INCLUDE="/usr/share/elasticsearch/bin/elasticsearch.in.sh" |
72 |
+export JAVA_OPTS |
73 |
+export ES_JAVA_OPTS |
74 |
+export ES_HEAP_SIZE |
75 |
+export ES_HEAP_NEWSIZE |
76 |
+export ES_DIRECT_SIZE |
77 |
+export ES_USE_IPV4 |
78 |
+ |
79 |
+server_command="/usr/share/elasticsearch/bin/elasticsearch" |
80 |
+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}" |
81 |
+ |
82 |
+depend() { |
83 |
+ use net |
84 |
+} |
85 |
+ |
86 |
+start() { |
87 |
+ # elasticsearch -Des.config=/path/to/config/file |
88 |
+ # elasticsearch -Des.network.host=10.0.0.4 |
89 |
+ |
90 |
+ [ ! -f "${ES_INCLUDE}" ] && { |
91 |
+ eerror "${ES_INCLUDE} must be copied into place" |
92 |
+ return 1 |
93 |
+ } |
94 |
+ |
95 |
+ local conf |
96 |
+ local conf_file |
97 |
+ for conf in elasticsearch.yml logging.yml; do |
98 |
+ conf_file="${ES_CONF_PATH}/${conf}" |
99 |
+ if [ ! -f "${conf_file}" ]; then |
100 |
+ eerror "${conf_file} must be copied into place" |
101 |
+ return 1 |
102 |
+ fi |
103 |
+ done |
104 |
+ |
105 |
+ ebegin "Starting ${SVCNAME}" |
106 |
+ |
107 |
+ if [ -n "${ES_MAX_FD}" ]; then |
108 |
+ ulimit -n ${ES_MAX_FD} |
109 |
+ einfo "Max open filedescriptors : ${ES_MAX_FD}" |
110 |
+ fi |
111 |
+ |
112 |
+ checkpath -d -o "${ES_USER}" -m750 "/var/lib/elasticsearch" |
113 |
+ checkpath -d -o "${ES_USER}" -m750 "/var/log/elasticsearch" |
114 |
+ checkpath -d -o "${ES_USER}" -m750 "$(dirname "${PIDFILE}")" |
115 |
+ checkpath -d -o "${ES_USER}" -m750 "${ES_BASE_PATH}" |
116 |
+ checkpath -d -o "${ES_USER}" -m750 "${ES_LOG_PATH}" |
117 |
+ |
118 |
+ start-stop-daemon --start \ |
119 |
+ --background \ |
120 |
+ --chdir "${ES_BASE_PATH}" \ |
121 |
+ --user="${ES_USER}" \ |
122 |
+ --pidfile="${PIDFILE}" \ |
123 |
+ --exec ${server_command} -- ${server_args} |
124 |
+ eend $? |
125 |
+} |
126 |
+ |
127 |
+stop() { |
128 |
+ ebegin "Stopping ${SVCNAME}" |
129 |
+ start-stop-daemon --stop \ |
130 |
+ --pidfile=${PIDFILE} \ |
131 |
+ --user="${ES_USER}" \ |
132 |
+ --retry=TERM/20/KILL/5 |
133 |
+ eend $? |
134 |
+} |