Packaging improvements & bugfixes
* RPM: Use the ES_USER variable to set the user (same name as in the debian package now), while retaining backwards compatibility to existing /etc/sysconfig/elasticsearch * RPM: Bugfix: Remove the user when uninstalling the package * RPM: Set an existing homedir when adding the user (allows one to run cronjobs as this user) * DEB & RPM: Unify Required-Start/Required-Stop fields in initscripts
This commit is contained in:
parent
2e07af63ba
commit
2485c4890c
|
@ -11,8 +11,8 @@
|
|||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: elasticsearch
|
||||
# Required-Start: $all
|
||||
# Required-Stop: $all
|
||||
# Required-Start: $network $named
|
||||
# Required-Stop: $network $named
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Starts elasticsearch
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: Elasticsearch
|
||||
# Required-Start: $network
|
||||
# Required-Stop: $network
|
||||
# Required-Start: $network $named
|
||||
# Required-Stop: $network $named
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: This service manages the elasticsearch daemon
|
||||
|
@ -44,6 +44,11 @@ export ES_JAVA_OPTS
|
|||
|
||||
lockfile=/var/lock/subsys/$prog
|
||||
|
||||
# backwards compatibility for old config sysconfig files, pre 0.90.1
|
||||
if [ -n $USER ] && [ -z $ES_USER ] ; then
|
||||
ES_USER=$USER
|
||||
fi
|
||||
|
||||
start() {
|
||||
[ -x $exec ] || exit 5
|
||||
[ -f $CONF_FILE ] || exit 6
|
||||
|
@ -63,7 +68,7 @@ start() {
|
|||
fi
|
||||
echo -n $"Starting $prog: "
|
||||
# if not running, start it up here, usually something like "daemon $exec"
|
||||
daemon --user $USER --pidfile $pidfile $exec -p $pidfile -Des.default.path.home=$ES_HOME -Des.default.path.logs=$LOG_DIR -Des.default.path.data=$DATA_DIR -Des.default.path.work=$WORK_DIR -Des.default.path.conf=$CONF_DIR
|
||||
daemon --user $ES_USER --pidfile $pidfile $exec -p $pidfile -Des.default.path.home=$ES_HOME -Des.default.path.logs=$LOG_DIR -Des.default.path.data=$DATA_DIR -Des.default.path.work=$WORK_DIR -Des.default.path.conf=$CONF_DIR
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && touch $lockfile
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
echo "Removing elasticsearch user and group if existing"
|
||||
|
||||
getent passwd elasticsearch > /dev/null
|
||||
if [ "$?" == "1" ] ; then
|
||||
if [ "$?" == "0" ] ; then
|
||||
userdel elasticsearch
|
||||
fi
|
||||
|
||||
getent group elasticsearch >/dev/null
|
||||
if [ "$?" == "1" ] ; then
|
||||
if [ "$?" == "0" ] ; then
|
||||
groupdel elasticsearch
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
getent group elasticsearch >/dev/null || groupadd -r elasticsearch
|
||||
getent passwd elasticsearch >/dev/null || \
|
||||
useradd -r -g elasticsearch -d /usr/lib/elasticsearch -s /sbin/nologin \
|
||||
useradd -r -g elasticsearch -d /usr/share/elasticsearch -s /sbin/nologin \
|
||||
-c "elasticsearch user" elasticsearch
|
||||
|
|
|
@ -37,4 +37,4 @@ CONF_FILE=/etc/elasticsearch/elasticsearch.yml
|
|||
# User to run as, change this to a specific elasticsearch user if possible
|
||||
# Also make sure, this user can write into the log directories in case you change them
|
||||
# This setting only works for the init script, but has to be configured separately for systemd startup
|
||||
USER=elasticsearch
|
||||
ES_USER=elasticsearch
|
||||
|
|
Loading…
Reference in New Issue