From 8adba1d7c3c034ec8c990d4bbf0fe85a753d26c1 Mon Sep 17 00:00:00 2001 From: George Danchev Date: Sat, 2 Jul 2011 17:55:04 +0000 Subject: [PATCH] use a single log file for stdout and stderr --- releng/run_all_releng | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/releng/run_all_releng b/releng/run_all_releng index e0050c8d..be32b300 100755 --- a/releng/run_all_releng +++ b/releng/run_all_releng @@ -4,8 +4,8 @@ set -e SELF=$(basename "$0") GEN_DATA_DIR=releng_generated_data -CLOG1=${GEN_DATA_DIR}/log.${SELF}.1 -CLOG2=${GEN_DATA_DIR}/log.${SELF}.2 +CLOG=${GEN_DATA_DIR}/log.${SELF} + PASSED_OPTIONS="" if [ "${1}" == "-cleanup" ]; then @@ -18,7 +18,7 @@ else cat << HLP ${SELF} runs executables from CWD starting with releng_*. -stdout/stderr output stored in ${GEN_DATA_DIR}/log.* +stdout/stderr output stored in ${CLOG} ${SELF} -rc [-keep] ${SELF} -cleanup @@ -28,18 +28,19 @@ HLP fi ######################################################## - > ${CLOG1} - > ${CLOG2} + > ${CLOG} DSTART=`date --utc` printf "\n${SELF}: Started at ${DSTART}" E1=`date '+%s'` # require ^releng_, avoid running (your)self explcitly for s in `ls | grep ^releng_ | grep -v ${SELF} | sort -n`; do if [ -x ${s} -a ! -d ${s} ]; then - printf "\n${SELF}: Running ./${s} ${PASSED_OPTIONS}..." + # tee(1) does trailing \n, which is unwanted in that case + printf "\n${SELF}: Running ./${s} ${PASSED_OPTIONS}..." + echo -e "\n${SELF}: Running ./${s} ${PASSED_OPTIONS}..." >> ${CLOG} T1=`date '+%s'` set +e - ./${s} ${PASSED_OPTIONS} 1>>${CLOG1} 2>>${CLOG2} + ./${s} ${PASSED_OPTIONS} &>> ${CLOG} RET=$? T2=`date '+%s'` let TS="${T2} - ${T1}" @@ -59,13 +60,12 @@ fi printf "\n${SELF}: Stopped at ${DEND}.\n" if [ "${1}" == "-cleanup" ]; then - rm -f "${CLOG1}" "${CLOG2}" + rm -f "${CLOG}" else E2=`date '+%s'` let ES="${E2} - ${E1}" printf "\n${SELF}: Total time elapsed ${ES} sec." - printf "\n${SELF}: stdout saved in ${CLOG1}." - printf "\n${SELF}: stderr saved in ${CLOG2}.\n" + printf "\n${SELF}: stdout&stderr saved in ${CLOG}.\n" fi exit 0