Author: sebb
Date: Thu Nov 12 14:39:33 2015
New Revision: 1714057
URL: http://svn.apache.org/viewvc?rev=1714057&view=rev
Log:
Add svn add logging script
Added:
comdev/reporter.apache.org/trunk/scripts/svnadd.sh (with props)
Added: comdev/reporter.apache.org/trunk/scripts/svnadd.sh
URL:
http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/scripts/svnadd.sh?rev=1714057&view=auto
==============================================================================
--- comdev/reporter.apache.org/trunk/scripts/svnadd.sh (added)
+++ comdev/reporter.apache.org/trunk/scripts/svnadd.sh Thu Nov 12 14:39:33 2015
@@ -0,0 +1,43 @@
+# Script to run "svn add" and redirect standard output to /var/log/www-data
+# adds header and trailer to any output
+
+# Output log file is named after the SVN directory name plus the suffix
_YYYY-MM
+# This ensures that at most one month's data is in each log file
+
+# Sample crontab entry:
+# 40 * * * * cd /var/www/reporter.apache.org/scripts && ./svnadd.sh
../data/releases
+
+STARTED=$(date '+%Y-%m-%d %H:%M:%S')
+
+SVNDIR=${1?SVN directory}
+
+LOGDIR=/var/log/www-data
+
+BASE=$(basename $SVNDIR)
+
+YYMM=$(date '+%Y-%m')
+
+echo "exec >>${LOGDIR}/${BASE}_${YYMM}.log"
+
+svn status $SVNDIR | awk '/^\? / {print $2}' | xargs -r svn add | \
+{
+ # Read one line first
+ IFS= read -r line && \
+ {
+ # add header
+ echo
+ echo '>>>'
+ echo "Starting 'svn add $SVNDIR' at $STARTED"
+ echo "$line"
+
+ # read the rest of the lines
+ while IFS= read -r line
+ do
+ echo "$line"
+ done
+
+ # add trailer
+ echo "Completed 'svn add $SVNDIR' at $(date '+%Y-%m-%d %H:%M:%S')"
+ echo '<<<'
+ }
+}
Propchange: comdev/reporter.apache.org/trunk/scripts/svnadd.sh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: comdev/reporter.apache.org/trunk/scripts/svnadd.sh
------------------------------------------------------------------------------
svn:executable = *