clean logs on -cleanup, report their location

This commit is contained in:
George Danchev 2011-06-28 17:55:09 +00:00
parent bc9ef37711
commit 921f41bf74

View File

@ -4,8 +4,8 @@ set -e
SELF=$(basename "$0") SELF=$(basename "$0")
GEN_DATA_DIR=releng_generated_data GEN_DATA_DIR=releng_generated_data
CLOG1=${GEN_DATA_DIR}/log.$SELF.1 CLOG1=${GEN_DATA_DIR}/log.${SELF}.1
CLOG2=${GEN_DATA_DIR}/log.$SELF.2 CLOG2=${GEN_DATA_DIR}/log.${SELF}.2
PASSED_OPTIONS="" PASSED_OPTIONS=""
if [ "${1}" == "-cleanup" ]; then if [ "${1}" == "-cleanup" ]; then
@ -27,8 +27,7 @@ HLP
exit 101 exit 101
fi fi
main() { ########################################################
#
> ${CLOG1} > ${CLOG1}
> ${CLOG2} > ${CLOG2}
DSTART=`date --utc` DSTART=`date --utc`
@ -43,7 +42,7 @@ main() {
./${s} ${PASSED_OPTIONS} 1>>${CLOG1} 2>>${CLOG2} ./${s} ${PASSED_OPTIONS} 1>>${CLOG1} 2>>${CLOG2}
RET=$? RET=$?
T2=`date '+%s'` T2=`date '+%s'`
let TS="${T2}-${T1}" let TS="${T2} - ${T1}"
case ${RET} in case ${RET} in
0) 0)
printf "done in ${TS} sec. ok." printf "done in ${TS} sec. ok."
@ -58,14 +57,15 @@ main() {
DEND=`date --utc` DEND=`date --utc`
printf "\n${SELF}: Stopped at ${DEND}.\n" printf "\n${SELF}: Stopped at ${DEND}.\n"
E2=`date '+%s'`
let ES="${E2}-${E1}" if [ "${1}" == "-cleanup" ]; then
printf "\n${SELF}: Total time elapsed ${ES} sec." rm -f "${CLOG1}" "${CLOG2}"
printf "\n${SELF}: Results saved in ${CLOG1} and ${CLOG2}.\n\n" 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"
fi
#
exit 0 exit 0
}
#
main