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 2015/11/03 00:04:39 UTC

svn commit: r1712178 - /comdev/reporter.apache.org/trunk/scripts/python3logger.sh

Author: sebb
Date: Mon Nov  2 23:04:39 2015
New Revision: 1712178

URL: http://svn.apache.org/viewvc?rev=1712178&view=rev
Log:
Needed here too
TODO remove original once scripts have been migrated

Added:
    comdev/reporter.apache.org/trunk/scripts/python3logger.sh   (with props)

Added: comdev/reporter.apache.org/trunk/scripts/python3logger.sh
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/scripts/python3logger.sh?rev=1712178&view=auto
==============================================================================
--- comdev/reporter.apache.org/trunk/scripts/python3logger.sh (added)
+++ comdev/reporter.apache.org/trunk/scripts/python3logger.sh Mon Nov  2 23:04:39 2015
@@ -0,0 +1,29 @@
+# Script to redirect standard output of a python3 script to /var/log/www-data
+
+# Output log file is named after the script file name plus the suffix _YYYY-MM
+# This ensures that at most one month's data is in each log file
+
+# Sample usage:
+# cd .../scripts/cronjobs && ./python3logger.sh parsepmcs.py
+
+SCRIPT=${1?Script name}
+
+LOGDIR=/var/log/www-data
+
+BASE=$(basename $SCRIPT .py)
+
+YYMM=$(date '+%Y-%m')
+
+exec  >>${LOGDIR}/${BASE}_${YYMM}.log
+echo
+echo '>>>'
+echo Starting $SCRIPT at $(date)
+export
+
+# show the process tree
+#pstree -slapA $$
+
+ERRTEE=1 python3 -u $SCRIPT 
+
+echo Completed $SCRIPT at $(date)
+echo '<<<'

Propchange: comdev/reporter.apache.org/trunk/scripts/python3logger.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: comdev/reporter.apache.org/trunk/scripts/python3logger.sh
------------------------------------------------------------------------------
    svn:executable = *