Update after @eletrical review
This commit is contained in:
parent
867955188e
commit
0dad33f17f
|
@ -3,28 +3,25 @@
|
|||
################################
|
||||
|
||||
# Elasticsearch home directory
|
||||
ES_HOME=${packaging.elasticsearch.home.dir}
|
||||
#ES_HOME=${packaging.elasticsearch.home.dir}
|
||||
|
||||
# Elasticsearch configuration directory
|
||||
CONF_DIR=${packaging.elasticsearch.conf.dir}
|
||||
#CONF_DIR=${packaging.elasticsearch.conf.dir}
|
||||
|
||||
# Elasticsearch configuration file
|
||||
CONF_FILE=$CONF_DIR/elasticsearch.yml
|
||||
#CONF_FILE=$CONF_DIR/elasticsearch.yml
|
||||
|
||||
# Elasticsearch data directory
|
||||
DATA_DIR=${packaging.elasticsearch.data.dir}
|
||||
#DATA_DIR=${packaging.elasticsearch.data.dir}
|
||||
|
||||
# Elasticsearch logs directory
|
||||
LOG_DIR=${packaging.elasticsearch.log.dir}
|
||||
#LOG_DIR=${packaging.elasticsearch.log.dir}
|
||||
|
||||
# Elasticsearch work directory
|
||||
WORK_DIR=${packaging.elasticsearch.work.dir}
|
||||
|
||||
# Elasticsearch plugins directory
|
||||
PLUGINS_DIR=${packaging.elasticsearch.plugins.dir}
|
||||
#WORK_DIR=${packaging.elasticsearch.work.dir}
|
||||
|
||||
# Elasticsearch PID directory
|
||||
PID_DIR=${packaging.elasticsearch.pid.dir}
|
||||
#PID_DIR=${packaging.elasticsearch.pid.dir}
|
||||
|
||||
# Heap size defaults to ${packaging.elasticsearch.heap.min} min, ${packaging.elasticsearch.heap.max} max
|
||||
# Set ES_HEAP_SIZE to 50% of available RAM, but no more than 31g
|
||||
|
@ -56,8 +53,8 @@ PID_DIR=${packaging.elasticsearch.pid.dir}
|
|||
# Note that this setting is only used by the init script. If changed, make sure that
|
||||
# the configured user can read and write into the data, work, plugins and log directories.
|
||||
# For systemd service, the user is usually configured in file ${packaging.elasticsearch.systemd.dir}/elasticsearch.service
|
||||
ES_USER=${packaging.elasticsearch.user}
|
||||
ES_GROUP=${packaging.elasticsearch.group}
|
||||
#ES_USER=${packaging.elasticsearch.user}
|
||||
#ES_GROUP=${packaging.elasticsearch.group}
|
||||
|
||||
################################
|
||||
# System properties
|
||||
|
@ -66,7 +63,7 @@ ES_GROUP=${packaging.elasticsearch.group}
|
|||
# Specifies the maximum file descriptor number that can be opened by this process
|
||||
# When using Systemd, this setting is ignored and the LimitNOFILE defined in
|
||||
# ${packaging.elasticsearch.systemd.dir}/elasticsearch.service takes precedence
|
||||
MAX_OPEN_FILES=${packaging.os.max.open.files}
|
||||
#MAX_OPEN_FILES=${packaging.os.max.open.files}
|
||||
|
||||
# The maximum number of bytes of memory that may be locked into RAM
|
||||
# Set to "unlimited" if you use the 'bootstrap.mlockall: true' option
|
||||
|
@ -78,4 +75,4 @@ MAX_OPEN_FILES=${packaging.os.max.open.files}
|
|||
# Maximum number of VMA (Virtual Memory Areas) a process can own
|
||||
# When using Systemd, this setting is ignored and the 'vm.max_map_count'
|
||||
# property is set at boot time in ${packaging.elasticsearch.systemd.sysctl.dir}/elasticsearch.conf
|
||||
MAX_MAP_COUNT=${packaging.os.max.map.count}
|
||||
#MAX_MAP_COUNT=${packaging.os.max.map.count}
|
||||
|
|
|
@ -12,12 +12,14 @@ ${packaging.scripts.header}
|
|||
|
||||
|
||||
|
||||
# Sets the default values for elasticsearch variables used in this script
|
||||
ES_USER="${packaging.elasticsearch.user}"
|
||||
ES_GROUP="${packaging.elasticsearch.group}"
|
||||
|
||||
# Source the default env file
|
||||
ES_ENV_FILE="${packaging.env.file}"
|
||||
if [ -f "$ES_ENV_FILE" ]; then
|
||||
. "$ES_ENV_FILE"
|
||||
else
|
||||
echo "Unable to source environment file $ES_ENV_FILE" >&2
|
||||
fi
|
||||
|
||||
IS_UPGRADE=false
|
||||
|
@ -51,10 +53,6 @@ case "$1" in
|
|||
;;
|
||||
esac
|
||||
|
||||
# Use default user and group
|
||||
[ -z "$ES_USER" ] && ES_USER="${packaging.elasticsearch.user}"
|
||||
[ -z "$ES_GROUP" ] && ES_GROUP="${packaging.elasticsearch.group}"
|
||||
|
||||
if [ "x$IS_UPGRADE" != "xtrue" ]; then
|
||||
if command -v systemctl >/dev/null; then
|
||||
echo "### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd"
|
||||
|
|
|
@ -50,13 +50,20 @@ case "$1" in
|
|||
;;
|
||||
esac
|
||||
|
||||
# Sets the default values for elasticsearch variables used in this script
|
||||
ES_USER="${packaging.elasticsearch.user}"
|
||||
ES_GROUP="${packaging.elasticsearch.group}"
|
||||
LOG_DIR="${packaging.elasticsearch.log.dir}"
|
||||
WORK_DIR="${packaging.elasticsearch.work.dir}"
|
||||
PLUGINS_DIR="${packaging.elasticsearch.plugins.dir}"
|
||||
PID_DIR="${packaging.elasticsearch.pid.dir}"
|
||||
DATA_DIR="${packaging.elasticsearch.data.dir}"
|
||||
|
||||
# Source the default env file
|
||||
if [ "$SOURCE_ENV_FILE" = "true" ]; then
|
||||
ES_ENV_FILE="${packaging.env.file}"
|
||||
if [ -f "$ES_ENV_FILE" ]; then
|
||||
. "$ES_ENV_FILE"
|
||||
else
|
||||
echo "Unable to source environment file $ES_ENV_FILE" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -76,40 +83,30 @@ fi
|
|||
|
||||
if [ "$REMOVE_DIRS" = "true" ]; then
|
||||
|
||||
[ -z "$LOG_DIR" ] && LOG_DIR="${packaging.elasticsearch.log.dir}"
|
||||
|
||||
if [ -d "$LOG_DIR" ]; then
|
||||
echo -n "Deleting log directory..."
|
||||
rm -rf "$LOG_DIR"
|
||||
echo " OK"
|
||||
fi
|
||||
|
||||
[ -z "$WORK_DIR" ] && WORK_DIR="${packaging.elasticsearch.work.dir}"
|
||||
|
||||
if [ -d "$WORK_DIR" ]; then
|
||||
echo -n "Deleting work directory..."
|
||||
rm -rf "$WORK_DIR"
|
||||
echo " OK"
|
||||
fi
|
||||
|
||||
[ -z "$PLUGINS_DIR" ] && PLUGINS_DIR="${packaging.elasticsearch.plugins.dir}"
|
||||
|
||||
if [ -d "$PLUGINS_DIR" ]; then
|
||||
echo -n "Deleting plugins directory..."
|
||||
rm -rf "$PLUGINS_DIR"
|
||||
echo " OK"
|
||||
fi
|
||||
|
||||
[ -z "$PID_DIR" ] && PID_DIR="${packaging.elasticsearch.pid.dir}"
|
||||
|
||||
if [ -d "$PID_DIR" ]; then
|
||||
echo -n "Deleting PID directory..."
|
||||
rm -rf "$PID_DIR"
|
||||
echo " OK"
|
||||
fi
|
||||
|
||||
[ -z "$DATA_DIR" ] && DATA_DIR="${packaging.elasticsearch.data.dir}"
|
||||
|
||||
# Delete the data directory if and only if empty
|
||||
if [ -d "$DATA_DIR" ]; then
|
||||
rmdir --ignore-fail-on-non-empty "$DATA_DIR"
|
||||
|
@ -117,12 +114,12 @@ if [ "$REMOVE_DIRS" = "true" ]; then
|
|||
fi
|
||||
|
||||
if [ "$REMOVE_USER_AND_GROUP" = "true" ]; then
|
||||
if id $ES_USER > /dev/null 2>&1 ; then
|
||||
userdel "${packaging.elasticsearch.user}"
|
||||
if id "$ES_USER" > /dev/null 2>&1 ; then
|
||||
userdel "$ES_USER"
|
||||
fi
|
||||
|
||||
if getent group "$ES_GROUP" > /dev/null 2>&1 ; then
|
||||
groupdel "${packaging.elasticsearch.group}"
|
||||
groupdel "$ES_GROUP"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -13,9 +13,15 @@ ${packaging.scripts.header}
|
|||
|
||||
|
||||
|
||||
# Define default user and group
|
||||
[ -z "$ES_USER" ] && ES_USER="${packaging.elasticsearch.user}"
|
||||
[ -z "$ES_GROUP" ] && ES_GROUP="${packaging.elasticsearch.group}"
|
||||
# Sets the default values for elasticsearch variables used in this script
|
||||
ES_USER="${packaging.elasticsearch.user}"
|
||||
ES_GROUP="${packaging.elasticsearch.group}"
|
||||
|
||||
# Source the default env file
|
||||
ES_ENV_FILE="${packaging.env.file}"
|
||||
if [ -f "$ES_ENV_FILE" ]; then
|
||||
. "$ES_ENV_FILE"
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
|
||||
|
|
|
@ -13,14 +13,6 @@ ${packaging.scripts.header}
|
|||
|
||||
|
||||
|
||||
# Source the default env file
|
||||
ES_ENV_FILE="${packaging.env.file}"
|
||||
if [ -f "$ES_ENV_FILE" ]; then
|
||||
. "$ES_ENV_FILE"
|
||||
else
|
||||
echo "Unable to source environment file $ES_ENV_FILE" >&2
|
||||
fi
|
||||
|
||||
STOP_REQUIRED=false
|
||||
|
||||
case "$1" in
|
||||
|
|
|
@ -5,7 +5,13 @@ Wants=network-online.target
|
|||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=/etc/default/elasticsearch
|
||||
Environment=CONF_FILE=${packaging.elasticsearch.conf.dir}/elasticsearch.yml
|
||||
Environment=ES_HOME=${packaging.elasticsearch.home.dir}
|
||||
Environment=LOG_DIR=${packaging.elasticsearch.log.dir}
|
||||
Environment=DATA_DIR=${packaging.elasticsearch.data.dir}
|
||||
Environment=WORK_DIR=${packaging.elasticsearch.work.dir}
|
||||
Environment=CONF_DIR=${packaging.elasticsearch.conf.dir}
|
||||
EnvironmentFile=-${packaging.env.file}
|
||||
User=elasticsearch
|
||||
Group=elasticsearch
|
||||
ExecStart=/usr/share/elasticsearch/bin/elasticsearch \
|
||||
|
|
|
@ -31,12 +31,28 @@ if [ -f /etc/rc.d/init.d/functions ]; then
|
|||
. /etc/rc.d/init.d/functions
|
||||
fi
|
||||
|
||||
exec="/usr/share/elasticsearch/bin/elasticsearch"
|
||||
# Sets the default values for elasticsearch variables used in this script
|
||||
ES_USER="${packaging.elasticsearch.user}"
|
||||
ES_GROUP="${packaging.elasticsearch.group}"
|
||||
ES_HOME="${packaging.elasticsearch.home.dir}"
|
||||
MAX_OPEN_FILES=${packaging.os.max.open.files}
|
||||
MAX_MAP_COUNT=${packaging.os.max.map.count}
|
||||
LOG_DIR="${packaging.elasticsearch.log.dir}"
|
||||
DATA_DIR="${packaging.elasticsearch.data.dir}"
|
||||
WORK_DIR="${packaging.elasticsearch.work.dir}"
|
||||
CONF_DIR="${packaging.elasticsearch.conf.dir}"
|
||||
CONF_FILE="${packaging.elasticsearch.conf.dir}/elasticsearch.yml"
|
||||
|
||||
# Source the default env file
|
||||
ES_ENV_FILE="${packaging.env.file}"
|
||||
if [ -f "$ES_ENV_FILE" ]; then
|
||||
. "$ES_ENV_FILE"
|
||||
fi
|
||||
|
||||
exec="$ES_HOME/bin/elasticsearch"
|
||||
prog="elasticsearch"
|
||||
pidfile=/var/run/elasticsearch/${prog}.pid
|
||||
|
||||
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
|
||||
|
||||
export ES_HEAP_SIZE
|
||||
export ES_HEAP_NEWSIZE
|
||||
export ES_DIRECT_SIZE
|
||||
|
|
|
@ -4,7 +4,13 @@ Documentation=http://www.elasticsearch.org
|
|||
|
||||
[Service]
|
||||
Type=forking
|
||||
EnvironmentFile=/etc/sysconfig/elasticsearch
|
||||
Environment=CONF_FILE=${packaging.elasticsearch.conf.dir}/elasticsearch.yml
|
||||
Environment=ES_HOME=${packaging.elasticsearch.home.dir}
|
||||
Environment=LOG_DIR=${packaging.elasticsearch.log.dir}
|
||||
Environment=DATA_DIR=${packaging.elasticsearch.data.dir}
|
||||
Environment=WORK_DIR=${packaging.elasticsearch.work.dir}
|
||||
Environment=CONF_DIR=${packaging.elasticsearch.conf.dir}
|
||||
EnvironmentFile=-${packaging.env.file}
|
||||
User=elasticsearch
|
||||
Group=elasticsearch
|
||||
PIDFile=/var/run/elasticsearch/elasticsearch.pid
|
||||
|
|
Loading…
Reference in New Issue