来自多个线程的同一文件上的CAT失败

时间:2017-03-08 10:24:31

标签: bash shell

    XML_OUTPUT=${WORK_DIR}/xml.txt
    errCode=`cat ${XML_OUTPUT} | grep ERR_CODES | cut -d "=" -f2`
    accesslog_filterMap=`cat ${XML_OUTPUT} | grep ACCESS_LOG_FM_VALUE | cut -d "=" -f2`
    sec_filterMap=`cat ${XML_OUTPUT} | grep SECURITY_FM_VALUE | cut -d "=" -f2`
    instrumentation_filterMap=`cat ${XML_OUTPUT} | grep INSTRUMENTATION_FM_VALUE | cut -d "=" -f2`
    serverhealthcheck_filterMap=`cat ${XML_OUTPUT} | grep SERVER_HEALTH_CHECK_FM_VALUE | cut -d "=" -f2`

xml.txt内容

ERR_CODES=400 401 403 404 408 413 414 500 505 java.lang.Throwable
INSTRUMENTATION_FM_VALUE=TRUE
ACCESS_LOG_FM_VALUE=TRUE
SECURITY_FM_VALUE=TRUE
SERVER_HEALTH_CHECK_FM_VALUE=TRUE

当我从多个线程运行此脚本时,它不会始终提供相同的结果。有时它(cat)返回空String。如何处理多线程环境?

0 个答案:

没有答案