community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1707272 - /comdev/projects.apache.org/scripts/cronjobs/python3logger.sh
Date Wed, 07 Oct 2015 12:19:13 GMT
Author: sebb
Date: Wed Oct  7 12:19:13 2015
New Revision: 1707272

URL: http://svn.apache.org/viewvc?rev=1707272&view=rev
Log:
Initial try at logging python3 output

Added:
    comdev/projects.apache.org/scripts/cronjobs/python3logger.sh   (with props)

Added: comdev/projects.apache.org/scripts/cronjobs/python3logger.sh
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/scripts/cronjobs/python3logger.sh?rev=1707272&view=auto
==============================================================================
--- comdev/projects.apache.org/scripts/cronjobs/python3logger.sh (added)
+++ comdev/projects.apache.org/scripts/cronjobs/python3logger.sh Wed Oct  7 12:19:13 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/projects.apache.org/scripts/cronjobs/python3logger.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: comdev/projects.apache.org/scripts/cronjobs/python3logger.sh
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message