From ad5123caf5b0e4c1795393b64a7ace2b4440ded4 Mon Sep 17 00:00:00 2001 From: August Schwer Date: Tue, 27 Nov 2012 15:52:05 -0800 Subject: [PATCH] Add a sane ULIMIT_N by default, and set the limit on number of open files even if we don't change user, or are already running as the RUN_AS_USER --- service/elasticsearch | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/service/elasticsearch b/service/elasticsearch index f60242a..d125cdd 100755 --- a/service/elasticsearch +++ b/service/elasticsearch @@ -88,7 +88,7 @@ WAIT_FOR_STARTED_TIMEOUT=120 # Specify the number of open files ulimit for the above user # recommended value: 32000 -#ULIMIT_N= +ULIMIT_N=32000 # By default we show a detailed usage block. Uncomment to show brief usage. #BRIEF_USAGE=true @@ -916,6 +916,12 @@ start() { then prepAdditionalParams "$@" + # Set ulimit if specified. + if [ "X$ULIMIT_N" != "X" ] + then + ulimit -n $ULIMIT_N + fi + # The string passed to eval must handles spaces in paths correctly. COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $STATUSPROP $COMMANDPROP $LOCKPROP wrapper.script.version=3.5.14 $ADDITIONAL_PARA" eval $COMMAND_LINE