From a9f01fed17974af0e1999447164936f1977ff14a Mon Sep 17 00:00:00 2001 From: Jakob Reiter Date: Mon, 19 Sep 2016 17:45:12 +0200 Subject: [PATCH 1/2] Updated systemd template with the changes from the one that ships with the .deb/.rpm. Closes #149 --- templates/systemd/elasticsearch.j2 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/templates/systemd/elasticsearch.j2 b/templates/systemd/elasticsearch.j2 index ab75b44e4ee96..714646fdd2ef5 100644 --- a/templates/systemd/elasticsearch.j2 +++ b/templates/systemd/elasticsearch.j2 @@ -12,9 +12,13 @@ Environment=LOG_DIR={{log_dir}} Environment=PID_DIR={{pid_dir}} EnvironmentFile=-{{instance_default_file}} +WorkingDirectory={{es_home}} + User={{es_user}} Group={{es_group}} +ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec + ExecStart={{es_home}}/bin/elasticsearch \ -Des.pidfile=${PID_DIR}/elasticsearch.pid \ -Des.default.path.home=${ES_HOME} \ @@ -24,11 +28,8 @@ ExecStart={{es_home}}/bin/elasticsearch \ -# Connects standard output to /dev/null -StandardOutput=null - -# Connects standard error to journal -StandardError=journal +StandardOutput=journal +StandardError=inherit # Specifies the maximum file descriptor number that can be opened by this process LimitNOFILE={{es_max_open_files}} From 34f4c49e001cef1c3d02708949c0c285a233201f Mon Sep 17 00:00:00 2001 From: Jakob Reiter Date: Tue, 20 Sep 2016 10:52:05 +0200 Subject: [PATCH 2/2] Added conditional for ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec, as its only available on ES >=2.0 --- templates/systemd/elasticsearch.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/systemd/elasticsearch.j2 b/templates/systemd/elasticsearch.j2 index 714646fdd2ef5..34d212b21c9db 100644 --- a/templates/systemd/elasticsearch.j2 +++ b/templates/systemd/elasticsearch.j2 @@ -17,7 +17,9 @@ WorkingDirectory={{es_home}} User={{es_user}} Group={{es_group}} +{% if es_version | version_compare('2.0', '>=') %} ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec +{% endif %} ExecStart={{es_home}}/bin/elasticsearch \ -Des.pidfile=${PID_DIR}/elasticsearch.pid \