diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2018-07-14 21:03:06 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2018-07-14 21:03:06 +0100 |
commit | 8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch) | |
tree | 7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /app-misc/elasticsearch/files/elasticsearch.init.3 | |
parent | 30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff) |
gentoo resync : 14.07.2018
Diffstat (limited to 'app-misc/elasticsearch/files/elasticsearch.init.3')
-rw-r--r-- | app-misc/elasticsearch/files/elasticsearch.init.3 | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/app-misc/elasticsearch/files/elasticsearch.init.3 b/app-misc/elasticsearch/files/elasticsearch.init.3 new file mode 100644 index 000000000000..cd89acd9f998 --- /dev/null +++ b/app-misc/elasticsearch/files/elasticsearch.init.3 @@ -0,0 +1,62 @@ +#!/sbin/openrc-run + +name="Elasticsearch" +description="Elasticsearch Server" + +ES_INSTANCE=${SVCNAME#*.} + +if [ -n "${ES_INSTANCE}" ] && [ ${SVCNAME} != "elasticsearch" ]; then + ES_BASE_PATH="/var/lib/elasticsearch/${ES_INSTANCE}" + CONF_DIR="/etc/elasticsearch/${ES_INSTANCE}" + DEFAULT_LOG_DIR="/var/log/elasticsearch/${ES_INSTANCE}" +else + ES_BASE_PATH="/var/lib/elasticsearch/_default" + CONF_DIR="/etc/elasticsearch" + DEFAULT_LOG_DIR="/var/log/elasticsearch/_default" +fi + +ES_HOME=${ES_HOME:="/usr/share/elasticsearch"} +ES_USER=${ES_USER:="elasticsearch"} +ES_GROUP=${ES_GROUP:="elasticsearch"} +ES_STARTUP_SLEEP_TIME=${ES_STARTUP_TIME:=5} +MAX_OPEN_FILES=${MAX_OPEN_FILES:=65536} +MAX_MAP_COUNT=${MAX_MAP_COUNT:=262144} + +DATA_DIR=${DATA_DIR:="${ES_BASE_PATH}/data"} +LOG_DIR=${LOG_DIR:="${DEFAULT_LOG_DIR}"} + +if [ -f "${CONF_DIR}/elasticsearch.in.sh" ]; then + ES_INCLUDE="${CONF_DIR}/elasticsearch.in.sh" +fi + +export ES_INCLUDE +export JAVA_HOME +export JAVA_OPTS +export ES_JVM_OPTIONS +export ES_JAVA_OPTS +export ES_STARTUP_SLEEP_TIME +export ES_PATH_CONF="${CONF_DIR}" + +pidfile="/run/elasticsearch/${RC_SVCNAME}.pid" + +command="/usr/share/elasticsearch/bin/elasticsearch" +command_args="--daemonize --pidfile=${pidfile} -Epath.logs=${LOG_DIR} -Epath.data=${DATA_DIR}" +command_user="${ES_USER}:${ES_GROUP}" +required_files="${CONF_DIR}/elasticsearch.yml" +retry="TERM/30/KILL/30" + +depend() { + use net +} + +start_pre() { + if [ -n "${MAX_MAP_COUNT}" -a -f /proc/sys/vm/max_map_count ]; then + sysctl -q -w vm.max_map_count=${MAX_MAP_COUNT} + fi + + checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "/var/lib/elasticsearch" + checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "/var/log/elasticsearch" + checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "/run/elasticsearch" + checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "${ES_BASE_PATH}" + checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "${LOG_DIR}" +} |