Skip to content

Commit

Permalink
#36, update sysv init templates
Browse files Browse the repository at this point in the history
  • Loading branch information
vkhatri committed Sep 15, 2015
1 parent e20fdf0 commit c695c04
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
14 changes: 12 additions & 2 deletions templates/default/initd.debian.erb
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,14 @@ case "$1" in

# Prepare environment
mkdir -p "$LOG_DIR" "$DATA_DIR" "$WORK_DIR" && chown "$ES_USER":"$ES_GROUP" "$LOG_DIR" "$DATA_DIR" "$WORK_DIR"
touch "$PID_FILE" && chown "$ES_USER":"$ES_GROUP" "$PID_FILE"

# Ensure that the PID_DIR exists (it is cleaned at OS startup time)
if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then
mkdir -p "$PID_DIR" && chown "$ES_USER":"$ES_GROUP" "$PID_DIR"
fi
if [ -n "$PID_FILE" ] && [ ! -e "$PID_FILE" ]; then
touch "$PID_FILE" && chown "$ES_USER":"$ES_GROUP" "$PID_FILE"
fi

if [ -n "$MAX_OPEN_FILES" ]; then
ulimit -n $MAX_OPEN_FILES
Expand All @@ -181,7 +188,10 @@ case "$1" in
do
sleep 1
i=$(($i + 1))
[ $i -gt $timeout ] && log_end_msg 1
if [ $i -gt $timeout ]; then
log_end_msg 1
exit 1
fi
done
else
log_end_msg $return
Expand Down
9 changes: 9 additions & 0 deletions templates/default/initd.rhel.erb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ start() {
mkdir -p "$WORK_DIR"
chown "$ES_USER":"$ES_GROUP" "$WORK_DIR"
fi

# Ensure that the PID_DIR exists (it is cleaned at OS startup time)
if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then
mkdir -p "$PID_DIR" && chown "$ES_USER":"$ES_GROUP" "$PID_DIR"
fi
if [ -n "$pidfile" ] && [ ! -e "$pidfile" ]; then
touch "$pidfile" && chown "$ES_USER":"$ES_GROUP" "$pidfile"
fi

echo -n $"Starting $prog: "
# if not running, start it up here, usually something like "daemon $exec"
daemon --user $ES_USER --pidfile $pidfile $exec -p $pidfile -d -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
Expand Down

0 comments on commit c695c04

Please sign in to comment.