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:33:44 UTC

svn commit: r1707277 - /comdev/reporter.apache.org/trunk/pythonlogger.sh

Author: sebb
Date: Wed Oct  7 12:33:44 2015
New Revision: 1707277

URL: http://svn.apache.org/viewvc?rev=1707277&view=rev
Log:
Same for python (2)

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

Added: comdev/reporter.apache.org/trunk/pythonlogger.sh
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/pythonlogger.sh?rev=1707277&view=auto
==============================================================================
--- comdev/reporter.apache.org/trunk/pythonlogger.sh (added)
+++ comdev/reporter.apache.org/trunk/pythonlogger.sh Wed Oct  7 12:33:44 2015
@@ -0,0 +1,26 @@
+# Script to redirect standard output of a python 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 && ./pythonlogger.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
+
+python -u $SCRIPT 
+
+echo Completed $SCRIPT at $(date)
+echo '<<<'

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

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