diff options
Diffstat (limited to 'textproc/elasticsearch5/files/elasticsearch.in')
-rw-r--r-- | textproc/elasticsearch5/files/elasticsearch.in | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/textproc/elasticsearch5/files/elasticsearch.in b/textproc/elasticsearch5/files/elasticsearch.in index f6a2496c82bd..925a3066dc37 100644 --- a/textproc/elasticsearch5/files/elasticsearch.in +++ b/textproc/elasticsearch5/files/elasticsearch.in @@ -15,7 +15,7 @@ # Set it to required username. # elasticsearch_group (group): Set to elasticsearch by default. # Set it to required group. -# elasticsearch_config (path): Set to /usr/local/etc/elasticsearch/elasticsearch.yml by default. +# elasticsearch_config (path): Set to %%PREFIX%%/etc/elasticsearch/elasticsearch.yml by default. # Set it to the config file location. # elasticsearch_tmp (path): Set to /var/tmp/elasticsearch by default. # Set it to the path to be used for temp files. @@ -27,31 +27,30 @@ rcvar=elasticsearch_enable load_rc_config ${name} -: ${elasticsearch_enable:="NO"} -: ${elasticsearch_user:=%%SEARCHUSER%%} -: ${elasticsearch_group:=%%SEARCHGROUP%%} -: ${elasticsearch_config:="%%PREFIX%%/etc/elasticsearch"} -: ${elasticsearch_tmp:="/var/tmp/elasticsearch"} +: ${elasticsearch_enable:=NO} +: ${elasticsearch_user=elasticsearch} +: ${elasticsearch_group=elasticsearch} +: ${elasticsearch_config=%%PREFIX%%/etc/elasticsearch} +: ${elasticsearch_tmp=/var/tmp/elasticsearch} required_files="${elasticsearch_config}/elasticsearch.yml" -_pidprefix="/var/run/elasticsearch" -pidfile="${_pidprefix}.pid" +_pidprefix=/var/run/elasticsearch +pidfile=${_pidprefix}.pid extra_commands="console status" -console_cmd="elasticsearch_console" -start_precmd="elasticsearch_precmd" -status_cmd="elasticsearch_status" -stop_cmd="elasticsearch_stop" -command="%%PREFIX%%/lib/elasticsearch/bin/elasticsearch" -command_args="-d --pidfile=${pidfile}" +console_cmd=elasticsearch_console +start_precmd=elasticsearch_precmd +status_cmd=elasticsearch_status +stop_cmd=elasticsearch_stop +command=%%PREFIX%%/lib/elasticsearch/bin/elasticsearch +command_args="-d --pidfile=${pidfile} -Epath.conf=${elasticsearch_config}" elasticsearch_precmd() { - touch ${pidfile} - chown ${elasticsearch_user}:${elasticsearch_group} ${pidfile} - /usr/bin/install -d -o ${elasticsearch_user} -g ${elasticsearch_group} -m 750 ${elasticsearch_tmp} - /usr/bin/install -d -o ${elasticsearch_user} -g ${elasticsearch_group} -m 750 /var/db/elasticsearch - /usr/bin/install -d -o ${elasticsearch_user} -g ${elasticsearch_group} -m 750 /var/log/elasticsearch + /usr/bin/install -o ${elasticsearch_user} -g ${elasticsearch_group} /dev/null ${pidfile} + /usr/bin/install -d -o ${elasticsearch_user} -g ${elasticsearch_group} -m 755 ${elasticsearch_tmp} + /usr/bin/install -d -o ${elasticsearch_user} -g ${elasticsearch_group} -m 755 /var/db/elasticsearch + /usr/bin/install -d -o ${elasticsearch_user} -g ${elasticsearch_group} -m 755 /var/log/elasticsearch } elasticsearch_console() @@ -60,7 +59,6 @@ elasticsearch_console() run_rc_command "start" } - elasticsearch_stop() { rc_pid=$(elasticsearch_check_pidfile $pidfile) @@ -72,7 +70,8 @@ elasticsearch_stop() fi echo "Stopping ${name}." - kill ${rc_pid} 2> /dev/null + kill $sig_stop ${rc_pid} + wait_for_pids ${rc_pid} } elasticsearch_status() @@ -102,15 +101,13 @@ elasticsearch_check_pidfile() debug "pid file ($_pidfile): no pid in file." return fi - if [ -n "`%%LOCALBASE%%/bin/jps -l | grep -e "^$_pid"`" ]; then + if [ -n "`%%PREFIX%%/bin/jps -l | grep -e "^$_pid"`" ]; then echo -n $_pid fi } if [ -n "$2" ]; then profile="$2" if [ "x${elasticsearch_profiles}" != "x" ]; then - pidfile="${_pidprefix}.${profile}.pid" - command_args="-d --pidfile=${pidfile}" eval elasticsearch_config="\${elasticsearch_${profile}_config:-}" if [ "x${elasticsearch_config}" = "x" ]; then echo "You must define a configuration (elasticsearch_${profile}_config)" @@ -120,6 +117,11 @@ if [ -n "$2" ]; then required_files="${elasticsearch_config}/jvm.options" eval elasticsearch_enable="\${elasticsearch_${profile}_enable:-${elasticsearch_enable}}" eval elasticsearch_tmp="\${elasticsearch_${profile}_args:-${elasticsearch_tmp}}" + pidfile="${_pidprefix}.${profile}.pid" + if [ -e ${elasticsearch_config}/jvm.options ]; then + export ES_JVM_OPTIONS=${elasticsearch_config}/jvm.options + fi + command_args="-d --pidfile=${pidfile} -Epath.conf=${elasticsearch_config}" else echo "$0: extra argument ignored" fi @@ -147,7 +149,7 @@ else ;; esac echo "===> elasticsearch profile: ${profile}" - /usr/local/etc/rc.d/elasticsearch $1 ${profile} + %%PREFIX%%/etc/rc.d/elasticsearch $1 ${profile} retcode="$?" if [ "0${retcode}" -ne 0 ]; then failed="${profile} (${retcode}) ${failed:-}" |