| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- 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
- if [[ -e ${logfile} ]]; then
- mv -f ${logfile} ${lastlogfile}
- fi
- if [[ "${odbpath}" != "" ]]; then
- echo ODBPATH="${odbpath}"
- fi
- if [[ "${keyspace}" != "" ]]; then
- echo keyspace="${keyspace}"
- fi
- sleep 2
- filepath=`echo "$@" | awk '{print $NF}'`
- if [[ "${filepath}" == "" ]]; then
- ./mql "$@"
- exit $?
- fi
- # remove ./
- filepath=${filepath/\.\//}
- # remove last slash
- filepath=${filepath%/}
- mqlproc=`ps -ef | grep -v grep | grep mql | grep "${filepath}"`
- if [[ "$mqlproc" != "" ]]; then
- echo "another mql test is running"
- exit 111
- fi
- ./mql "$@" 2>&1 | tee ${logfile}
- exit $?
|