Skip to content

Commit

Permalink
First cookie fix: do not poll the VM if not having start/stop hooks t…
Browse files Browse the repository at this point in the history
…o run.
  • Loading branch information
Olivier-Boudeville committed Aug 11, 2020
1 parent 86ad0a3 commit 731bd1c
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions priv/templates/extended_bin
Original file line number Diff line number Diff line change
Expand Up @@ -712,13 +712,15 @@ case "$1" in
"$BINDIR/run_erl" -daemon "$PIPE_DIR" "$RUNNER_LOG_DIR" \
"exec \"$RELEASE_ROOT_DIR/bin/$REL_NAME\" \"$START_OPTION\" $ARGS --relx-disable-hooks"

# wait for node to be up before running hooks
while ! erl_rpc erlang is_alive > /dev/null 2>&1
do
sleep 1
done

relx_run_hooks "$POST_START_HOOKS"
# Wait for node to be up before running any hooks
if [ -n "$POST_START_HOOKS" ]; then
while ! erl_rpc erlang is_alive > /dev/null 2>&1
do
sleep 1
done

relx_run_hooks "$POST_START_HOOKS"
fi
;;

stop)
Expand All @@ -733,13 +735,15 @@ case "$1" in
sleep 1
done

# wait for node to be down before running hooks
while erl_rpc erlang is_alive > /dev/null 2>&1
do
sleep 1
done
# Wait for node to be down before running any hooks
if [ -n "$POST_STOP_HOOKS" ]; then
while erl_rpc erlang is_alive > /dev/null 2>&1
do
sleep 1
done

relx_run_hooks "$POST_STOP_HOOKS"
relx_run_hooks "$POST_STOP_HOOKS"
fi
;;

restart)
Expand Down

0 comments on commit 731bd1c

Please sign in to comment.