Skip to content

Commit

Permalink
Tweak start script template
Browse files Browse the repository at this point in the history
  • Loading branch information
chaptastic committed Feb 17, 2015
1 parent c8b96ec commit 5f22691
Showing 1 changed file with 27 additions and 14 deletions.
41 changes: 27 additions & 14 deletions priv/templates/extended_bin.dtl
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,27 @@ find_erts_dir() {
relx_rem_sh() {
# Generate a unique id used to allow multiple remsh to the same node
# transparently

# User can specify an sname without @hostname
# This will fail when creating remote shell
# So here we check for @ and add @hostname if missing
case $NAME in
*@*)
REMSH_NAME=$NAME
;;
*)
# Add @hostname
REMSH_NAME=$NAME@`hostname -f`
;;
esac

id="remsh$(relx_gen_id)-${NAME}"

# Get the node's ticktime so that we use the same thing.
TICKTIME="$(relx_nodetool rpcterms net_kernel get_net_ticktime)"

# Setup remote shell command to control node
exec "$BINDIR/erl" "$NAME_TYPE" "$id" -remsh "$NAME" -boot start_clean \
exec "$BINDIR/erl" "$NAME_TYPE" "$id" -remsh "$REMSH_NAME" -boot start_clean \
-setcookie "$COOKIE" -kernel net_ticktime $TICKTIME
}

Expand Down Expand Up @@ -108,19 +122,6 @@ fi
NAME_TYPE="$(echo "$NAME_ARG" | awk '{print $1}')"
NAME="$(echo "$NAME_ARG" | awk '{print $2}')"

# User can specify an sname without @hostname
# This will fail when creating remote shell
# So here we check for @ and add @hostname if missing
case $NAME in
*@*)
# Nothing to do
;;
*)
# Add @hostname
NAME=$NAME@`hostname -f`
;;
esac

PIPE_DIR="${PIPE_DIR:-/tmp/erl_pipes/$NAME/}"

# Extract the target cookie
Expand Down Expand Up @@ -229,6 +230,18 @@ case "$1" in
exit $?
fi
;;
rpc)
## Send RPC command. Expects MFA as params
if ! relx_nodetool $@; then
exit $?
fi
;;
rpcterms)
## Send RPC command. Expects MFA as params
if ! relx_nodetool $@; then
exit $?
fi
;;

escript)
## Run an escript under the node's environment
Expand Down

0 comments on commit 5f22691

Please sign in to comment.