You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by se...@apache.org on 2016/02/13 00:09:49 UTC
svn commit: r1730141 -
/comdev/reporter.apache.org/trunk/scripts/python3logger.sh
Author: sebb
Date: Fri Feb 12 23:09:48 2016
New Revision: 1730141
URL: http://svn.apache.org/viewvc?rev=1730141&view=rev
Log:
Create current and cumulative logs
Modified:
comdev/reporter.apache.org/trunk/scripts/python3logger.sh
Modified: comdev/reporter.apache.org/trunk/scripts/python3logger.sh
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/scripts/python3logger.sh?rev=1730141&r1=1730140&r2=1730141&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/scripts/python3logger.sh (original)
+++ comdev/reporter.apache.org/trunk/scripts/python3logger.sh Fri Feb 12 23:09:48 2016
@@ -14,16 +14,27 @@ BASE=$(basename $SCRIPT .py)
YYMM=$(date '+%Y-%m')
-exec >>${LOGDIR}/${BASE}_${YYMM}.log
+# Create the cumulative log dir if necessary
+ARCHIVE_DIR=${LOGDIR}/${YYMM}
+test -d ${ARCHIVE_DIR} || mkdir ${ARCHIVE_DIR}
+
+ARCHIVE_NAME=${BASE}_${YYMM}.log
+
+# Move any existing cumulative log to the correct place:
+test -f ${LOGDIR}/${ARCHIVE_NAME} && mv ${LOGDIR}/${ARCHIVE_NAME} ${ARCHIVE_DIR}/${ARCHIVE_NAME}
+
+# Create cumulative log in subdirectory
+exec >>${ARCHIVE_DIR}/${ARCHIVE_NAME}
+{
echo
echo '>>>'
-echo Starting $SCRIPT at $(date)
+START=$(date)
+echo "Starting $SCRIPT ($$) at $START"
export
-# show the process tree
-#pstree -slapA $$
-
-ERRTEE=1 python3 -u $SCRIPT
+ERRTEE=1 python3 -u $SCRIPT
-echo Completed $SCRIPT at $(date)
+echo "Completed $SCRIPT ($$) at $(date) (START $START)"
echo '<<<'
+} | tee ${LOGDIR}/${BASE}.log
+# and last log in main directory
\ No newline at end of file