machi/rel/files/machi-admin

67 lines
1.6 KiB
Text
Raw Normal View History

#!/bin/sh
# -*- tab-width:4;indent-tabs-mode:nil -*-
# ex: ts=4 sw=4 et
# Pull environment for this install
. "{{runner_base_dir}}/lib/env.sh"
# Make sure the user running this script is the owner and/or su to that user
check_user "$@"
ES=$?
if [ "$ES" -ne 0 ]; then
exit $ES
fi
# Keep track of where script was invoked
ORIGINAL_DIR=$(pwd)
# Make sure CWD is set to runner run dir
cd $RUNNER_BASE_DIR
# Identify the script name
SCRIPT=`basename $0`
usage() {
echo "Usage: $SCRIPT { test | "
echo " top }"
}
case "$1" in
test)
# Make sure the local node IS running
node_up_check
shift
# Parse out the node name to pass to the client
NODE_NAME=${NAME_ARG#* }
$ERTS_PATH/erl -noshell $NAME_PARAM machi_test$NAME_HOST $COOKIE_ARG \
-pa $RUNNER_LIB_DIR/basho-patches \
-eval "case catch(machi:client_test(\"$NODE_NAME\")) of \
ok -> init:stop(); \
_ -> init:stop(1) \
end."
;;
top)
# Make sure the local node IS running
node_up_check
shift
MYPID=$$
NODE_NAME=${NAME_ARG#* }
$ERTS_PATH/erl -noshell -noinput \
-pa $RUNNER_LIB_DIR/basho-patches \
-hidden $NAME_PARAM machi_etop$MYPID$NAME_HOST $COOKIE_ARG \
-s etop -s erlang halt -output text \
-node $NODE_NAME \
$* -tracing off
;;
*)
usage
exit 1
;;
esac