[Piuparts-commits] rev 506 - in piatti/home/piupartsm: . bin
Holger Levsen
holger at alioth.debian.org
Mon Sep 21 14:05:53 UTC 2009
Author: holger
Date: 2009-09-21 14:05:52 +0000 (Mon, 21 Sep 2009)
New Revision: 506
Added:
piatti/home/piupartsm/bin/archive_old_logs
Modified:
piatti/home/piupartsm/crontab
Log:
archive old logfiles, as they confuse the grouping displayed in the webinterface - /me waves to #547674
Added: piatti/home/piupartsm/bin/archive_old_logs
===================================================================
--- piatti/home/piupartsm/bin/archive_old_logs (rev 0)
+++ piatti/home/piupartsm/bin/archive_old_logs 2009-09-21 14:05:52 UTC (rev 506)
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+# Copyright 2009 Holger Levsen (holger at layer-acht.org)
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+#
+# parse config file
+#
+
+TEMPFILE=`mktemp`
+egrep "(^sections|^master-directory)" /etc/piuparts/piuparts.conf| sed -e "s# =#=#g" -e "s#= #=#g" -e 's#=#="#' -e 's#$#"#' -e "s#sections#SECTIONS#" -e "s#master-directory#MASTER#" > $TEMPFILE
+source $TEMPFILE
+rm $TEMPFILE
+if [ -z "$MASTER" ] || [ -z "$SECTIONS" ] ; then
+ echo "sections and/or master-directory not set in /etc/piuparts/piuparts.conf, exiting."
+ exit 1
+fi
+
+#
+# archive old log files
+#
+
+# bash has some severe limitations, like no named arrays... :/
+NR=0
+for SECTION in $SECTIONS ; do
+ mkdir -o $MASTER/$SECTION/archive
+ cd $MASTER/$SECTION
+ for DIR in fail pass bugged ; do
+ cd $DIR
+ for LOG in $( for i in `ls -1 | cut -d "_" -f1|sort -u `; do ls -rt1 $i*|sed '$d' ; done ) ; do
+ [ -z "$LOG" ] || mv $LOG $MASTER/$SECTION/archive/$DIR
+ done
+ done
+ let "NR += 1"
+done
+
Property changes on: piatti/home/piupartsm/bin/archive_old_logs
___________________________________________________________________
Added: svn:executable
+ *
Modified: piatti/home/piupartsm/crontab
===================================================================
--- piatti/home/piupartsm/crontab 2009-09-20 16:24:29 UTC (rev 505)
+++ piatti/home/piupartsm/crontab 2009-09-21 14:05:52 UTC (rev 506)
@@ -25,6 +25,7 @@
0 23 * * * /home/piupartsm/bin/detect_archive_issues
5 23 * * * /home/piupartsm/bin/detect_piuparts_issues
10 23 * * * /home/piupartsm/bin/report_untestable_packages
+15 23 * * * /home/piupartsm/bin/archive_old_logs
#
# misc
More information about the Piuparts-commits
mailing list