Skip to content

Commit

Permalink
Debian package: Prevent init script from returning when the service i…
Browse files Browse the repository at this point in the history
…sn't actually started.

Close #6909
  • Loading branch information
sbraz authored and jpountz committed Dec 5, 2014
1 parent 7215531 commit 6c2abcc
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/deb/init.d/elasticsearch
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,21 @@ case "$1" in

# Start Daemon
start-stop-daemon --start -b --user "$ES_USER" -c "$ES_USER" --pidfile "$PID_FILE" --exec $DAEMON -- $DAEMON_OPTS
log_end_msg $?
return=$?
if [ $return -eq 0 ]
then
i=0
timeout=10
# Wait for the process to be properly started before exiting
until { cat "$PID_FILE" | xargs kill -0; } >/dev/null 2>&1
do
sleep 1
i=$(($i + 1))
[ $i -gt $timeout ] && log_end_msg 1
done
else
log_end_msg $return
fi
;;
stop)
log_daemon_msg "Stopping $DESC"
Expand Down

0 comments on commit 6c2abcc

Please sign in to comment.