community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1712178 - /comdev/reporter.apache.org/trunk/scripts/python3logger.sh
Date Mon, 02 Nov 2015 23:04:39 GMT
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 = *



Mime
View raw message