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