machi/rel/files/machi-admin
Scott Lystig Fritchie 58d2a43b37 Very first packaging draft, no cuttlefish
* "make rel" does something not horrible
* `rel/machi/bin/machi console` launches a console to an idle VM
2015-10-16 01:23:10 +09:00

68 lines
1.6 KiB
Bash
Executable file

#!/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 }"
}
stat_admin()
{
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