#!/bin/sh                                                                       

CMD=""
PYTH_PATH="PYTHONPATH=/SHARE/USERFS/els7/users/galaxy/develop/usr-cluster/lib/p\
ython2.7/site-packages/:/SHARE/USERFS/els7/users/biobank/lib/"
runner="$(dirname ${BASH_SOURCE[0]})/"
until [ -z $1 ]
    do

    opt_host='--host='
    opt_interpreter='--interpreter='
    opt_runner='--runner='
    if [[ $1 == $opt_host* ]]; then
        PYTH_PATH+=`echo $1 | cut -d '=' -f2 | cut -d '.' -f1`
        CMD+=' '$1
    elif [[ $1 == $opt_runner* ]]; then
        runner+=`echo $1 | cut -d '=' -f2`
    elif [[ $1 == $opt_interpreter* ]]; then
        interpreter=`echo $1 | cut -d '=' -f2`
    else
        CMD+=' '$1
    fi
    shift
done
export $PYTH_PATH/:$PYTHONPATH
CMD=$interpreter' '$runner$CMD
$CMD
