From fd8ea77fa483e889e580f3ecb6e90f7168d6f0fb Mon Sep 17 00:00:00 2001 From: Frank Fischer Date: Mon, 14 Jan 2019 15:53:01 +0100 Subject: [PATCH] Use systemd's RequiresMountsFor User might be interested in separating data in ephemeral and persistent state, especially in cloud environments, e.g. data_dir on another disk. --- templates/systemd/elasticsearch.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/systemd/elasticsearch.j2 b/templates/systemd/elasticsearch.j2 index 8bd5545c..79fe3825 100644 --- a/templates/systemd/elasticsearch.j2 +++ b/templates/systemd/elasticsearch.j2 @@ -3,6 +3,8 @@ Description=Elasticsearch-{{es_instance_name}} Documentation=http://www.elastic.co Wants=network-online.target After=network-online.target +{# Directive 'WorkingDirectory' creates an implicit dependecy for {{es_home}}, so it can be omitted here #} +RequiresMountsFor={{ data_dirs | array_to_str(separator=' ') }} {{log_dir}} {{pid_dir}} {{conf_dir}} [Service] Environment=ES_HOME={{es_home}}