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:00 UTC

svn commit: r1730140 - /comdev/projects.apache.org/scripts/cronjobs/python3logger.sh

Author: sebb
Date: Fri Feb 12 23:09:00 2016
New Revision: 1730140

URL: http://svn.apache.org/viewvc?rev=1730140&view=rev
Log:
Create current and cumulative logs

Modified:
    comdev/projects.apache.org/scripts/cronjobs/python3logger.sh

Modified: comdev/projects.apache.org/scripts/cronjobs/python3logger.sh
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/scripts/cronjobs/python3logger.sh?rev=1730140&r1=1730139&r2=1730140&view=diff
==============================================================================
--- comdev/projects.apache.org/scripts/cronjobs/python3logger.sh (original)
+++ comdev/projects.apache.org/scripts/cronjobs/python3logger.sh Fri Feb 12 23:09:00 2016
@@ -14,14 +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 '>>>'
 START=$(date)
 echo "Starting $SCRIPT ($$) at $START"
 export
 
-ERRTEE=1 python3 -u $SCRIPT 
+ERRTEE=1 python3 -u $SCRIPT
 
 echo "Completed $SCRIPT ($$) at $(date) (START $START)"
 echo '<<<'
+}  | tee ${LOGDIR}/${BASE}.log
+# and last log in main directory
\ No newline at end of file