From ac2124102ffa8c23504ff31cd4daad26bdd25374 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Thu, 1 Aug 2013 16:38:23 +0200 Subject: [PATCH] Run `ulimit` in the init script to prevent errors when /etc/security/limits.d is ignored This follows the conventions in the official .deb and .rpm packages from elasticsearch/elasticsearch#2059. See: * https://github.com/elasticsearch/elasticsearch/blob/master/src/deb/init.d/elasticsearch#L148-L154 * https://github.com/elasticsearch/elasticsearch/blob/master/src/rpm/init.d/elasticsearch#L75-L83 This is part of a larger changeset by @chrisroberts in #103. Closes: #103 Closes: #109 Related: #101 Related: #102 --- templates/default/elasticsearch.init.erb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/templates/default/elasticsearch.init.erb b/templates/default/elasticsearch.init.erb index 0947ef689..4c9532ee3 100644 --- a/templates/default/elasticsearch.init.erb +++ b/templates/default/elasticsearch.init.erb @@ -8,10 +8,16 @@ # config: <%= node[:elasticsearch][:path][:conf] %>/elasticsearch.yml # Source networking configuration +# if [ -f /etc/sysconfig/network ]; then source /etc/sysconfig/network; fi # Source defaults if found if [ -f /etc/default/elasticsearch ]; then source /etc/default/elasticsearch; fi +# Set limits for environments ignoring `/etc/security/limits.d` +# +ulimit -n <%= node[:elasticsearch][:limits][:nofile] %> +ulimit -l <%= node[:elasticsearch][:limits][:memlock] %> + # Exit if networking is not up # [ "$NETWORKING" = "no" ] && exit