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`
@ -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"
if [ "${1}" == "-cleanup" ]; then
rm -f "${CLOG1}" "${CLOG2}"
else
E2=`date '+%s'` E2=`date '+%s'`
let ES="${E2} - ${E1}" let ES="${E2} - ${E1}"
printf "\n${SELF}: Total time elapsed ${ES} sec." printf "\n${SELF}: Total time elapsed ${ES} sec."
printf "\n${SELF}: Results saved in ${CLOG1} and ${CLOG2}.\n\n" printf "\n${SELF}: stdout saved in ${CLOG1}."
printf "\n${SELF}: stderr saved in ${CLOG2}.\n"
fi
#
exit 0 exit 0
}
#
main