export LANG=zh_CN.utf8 export LC_ALL=zh_CN.utf8 2>/dev/null #改变工作目录到当前脚本所在路径 if [[ "$0" =~ / ]]; then cd "${0%/*}"; fi export CWD=`pwd` if [[ ! -e "mql.conf" ]]; then if [[ "${ODBPATH}" = "" ]]; then export ODBPATH=127.0.0.1:11001 fi if [[ "${KEYSPACE}" = "" ]]; then export KEYSPACE=oktest fi fi odbpath=`./mql odbpath? log.level=error "$@"` keyspace=`./mql keyspace? log.level=error "$@"` if [[ `echo "${keyspace}" | wc -w` == "1" ]]; then logfile="${keyspace}.test.log" lastlogfile="${keyspace}.last.log" else logfile="test.log" lastlogfile="last.log" fi mv -f ${logfile} ${lastlogfile} if [[ "${odbpath}" != "" ]]; then echo ODBPATH="${odbpath}" fi if [[ "${keyspace}" != "" ]]; then echo keyspace="${keyspace}" fi sleep 2 filepath=`echo "$@" | awk '{print $NF}' # remove ./ filepath=${filepath/\.\//} # remove last slash filepath=${filepath%/} mqlproc=`ps -ef | grep -v grep | grep mql | grep "${filepath}"` if [[ "$mqlproc" != "" ]]; then echo "mql test is running" exit 111 fi ./mql "$@" 2>&1 | tee ${logfile} exit $?