community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1714067 - /comdev/projects.apache.org/scripts/cronjobs/svnadd.sh
Date Thu, 12 Nov 2015 15:16:16 GMT
Author: sebb
Date: Thu Nov 12 15:16:16 2015
New Revision: 1714067

URL: http://svn.apache.org/viewvc?rev=1714067&view=rev
Log:
Add svn add logging script

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

Added: comdev/projects.apache.org/scripts/cronjobs/svnadd.sh
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/scripts/cronjobs/svnadd.sh?rev=1714067&view=auto
==============================================================================
--- comdev/projects.apache.org/scripts/cronjobs/svnadd.sh (added)
+++ comdev/projects.apache.org/scripts/cronjobs/svnadd.sh Thu Nov 12 15:16:16 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:
+# 10 4 * * *      cd /var/www/projects.apache.org/scripts/cronjobs && ./svnadd.sh
../../site/json
+
+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/projects.apache.org/scripts/cronjobs/svnadd.sh
------------------------------------------------------------------------------
    svn:eol-style = native

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



Mime
View raw message