#!/bin/sh if (("$#" < 4)) || (("$#" > 6)); then echo "Usage: $0 [--debug]" echo "Ex: $0 127.0.0.1 8899 ElJdBQQI 0 987654321" echo "Ex: $0 172.17.28.110 8899 ElJdBQQI 1 987654321 --debug" exit fi # --> get the dir of this script SOURCE="${BASH_SOURCE[0]}" # resolve $SOURCE until the file is no longer a symlink while [ -h "$SOURCE" ]; do DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )" SOURCE="$(readlink "$SOURCE")" [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it # relative to the path where the symlink file was located done SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )" # --> set python3 env . $SCRIPT_DIR/set_py3_env.sh > /dev/null 2>&1 # --> decide PY or PYC if [ -e "$HBS_INST_PATH/rr2/bin/remote_run.pyc" ]; then PY_ENTRY="$HBS_INST_PATH/rr2/bin/remote_run.pyc" else PY_ENTRY="$HBS_INST_PATH/rr2/bin/remote_run.py" fi # --> decide args DEBUG_STR= for arg in $* do if [ $arg == "--debug" ]; then DEBUG_STR=--debug echo "*** DEBUG MODE" break fi done HOSTIP=$1 PORT=$2 ENCPWD=$3 SSL_STR= if [ $4 == "True" ] || [ $4 == "true" ] || [ $4 == "1" ]; then SSL_STR=--ssl fi ACT=send_job_info ACT_ARGS="{\"job_id\":\"$5\"}" # --> run py python3 $PY_ENTRY -host $HOSTIP -encpwd $ENCPWD -rr2 $ACT -actargs "$ACT_ARGS" --port $PORT $SSL_STR $DEBUG_ARG exit 0