#!/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 { quick-admin-check | quick-admin-apply | " echo " top }" } case "$1" in quick-admin-check) # Make sure the local node IS running node_up_check shift NODE_NAME=${NAME_ARG#* } # target machi server node name IN_FILE="$1" $ERTS_PATH/erl -noshell -noinput $NAME_PARAM machi_test$NAME_HOST $COOKIE_ARG \ -remsh $NODE_NAME \ -eval "Me = self(), spawn('"$NODE_NAME"', fun() -> X = (catch(machi_lifecycle_mgr:quick_admin_sanity_check(\"$IN_FILE\"))), Me ! {res, X} end), XX = receive {res, Res} -> Res after 10*1000 -> timeout end, io:format(user, \"Result: ~p\n\", [XX]), case XX of \ ok -> init:stop(); \ _ -> init:stop(1) \ end." ;; quick-admin-apply) # Make sure the local node IS running node_up_check shift NODE_NAME=${NAME_ARG#* } # target machi server node name IN_FILE="$1" RELATIVE_HOST="$2" $ERTS_PATH/erl -noshell -noinput $NAME_PARAM machi_test$NAME_HOST $COOKIE_ARG \ -remsh $NODE_NAME \ -eval "Me = self(), spawn('"$NODE_NAME"', fun() -> X = (catch(machi_lifecycle_mgr:quick_admin_apply(\"$IN_FILE\", \"$RELATIVE_HOST\"))), Me ! {res, X} end), XX = receive {res, Res} -> Res after 10*1000 -> timeout end, io:format(user, \"Result: ~p\n\", [XX]), case XX 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