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/10/07 14:30:38 UTC
svn commit: r1707276 -
/comdev/reporter.apache.org/trunk/data/python3logger.sh
Author: sebb
Date: Wed Oct 7 12:30:38 2015
New Revision: 1707276
URL: http://svn.apache.org/viewvc?rev=1707276&view=rev
Log:
Initial try at logging python3 output
Added:
comdev/reporter.apache.org/trunk/data/python3logger.sh (with props)
Added: comdev/reporter.apache.org/trunk/data/python3logger.sh
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/data/python3logger.sh?rev=1707276&view=auto
==============================================================================
--- comdev/reporter.apache.org/trunk/data/python3logger.sh (added)
+++ comdev/reporter.apache.org/trunk/data/python3logger.sh Wed Oct 7 12:30:38 2015
@@ -0,0 +1,26 @@
+# 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
+
+python3 -u $SCRIPT
+
+echo Completed $SCRIPT at $(date)
+echo '<<<'
Propchange: comdev/reporter.apache.org/trunk/data/python3logger.sh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: comdev/reporter.apache.org/trunk/data/python3logger.sh
------------------------------------------------------------------------------
svn:executable = *