From 3c6e6ac0d11640e15829712d398d2b4041431c99 Mon Sep 17 00:00:00 2001 From: Gregoire Seux Date: Mon, 10 Mar 2014 16:15:32 +0100 Subject: [PATCH] Better handling of pid_path This commit fixes #193 --- recipes/default.rb | 7 ++++++- templates/default/elasticsearch.init.erb | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/recipes/default.rb b/recipes/default.rb index 5f25e0a98..c6957dd66 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -35,7 +35,7 @@ # Create ES directories # -[ node.elasticsearch[:path][:conf], node.elasticsearch[:path][:logs], node.elasticsearch[:pid_path] ].each do |path| +[ node.elasticsearch[:path][:conf], node.elasticsearch[:path][:logs] ].each do |path| directory path do owner node.elasticsearch[:user] and group node.elasticsearch[:user] and mode 0755 recursive true @@ -43,6 +43,11 @@ end end +directory node.elasticsearch[:pid_path] do + mode '0755' + recursive true +end + # Create data path directories # data_paths = node.elasticsearch[:path][:data].is_a?(Array) ? node.elasticsearch[:path][:data] : node.elasticsearch[:path][:data].split(',') diff --git a/templates/default/elasticsearch.init.erb b/templates/default/elasticsearch.init.erb index d9e7df9a5..42b30a0e5 100644 --- a/templates/default/elasticsearch.init.erb +++ b/templates/default/elasticsearch.init.erb @@ -39,6 +39,7 @@ start() { fi echo -e "\033[1mStarting elasticsearch...\033[0m" + touch $PIDFILE && chown <%= node[:elasticsearch][:user] %> $PIDFILE <% if node.platform_family == 'debian' %> ES_INCLUDE=$ES_INCLUDE start-stop-daemon --background --start --quiet --pidfile $PIDFILE --chuid <%= node[:elasticsearch][:user] %> --exec /usr/local/bin/elasticsearch -- -p $PIDFILE <% else %>