[Piuparts-commits] rev 891 - in piatti/home/piupartsm: . bin

Holger Levsen holger at alioth.debian.org
Sat Apr 2 10:34:55 UTC 2011


Author: holger
Date: 2011-04-02 10:34:53 +0000 (Sat, 02 Apr 2011)
New Revision: 891

Added:
   piatti/home/piupartsm/bin/reschedule_oldest_logs
Modified:
   piatti/home/piupartsm/crontab
Log:
new daily cronjob: reschedule 100 oldest logs per section (if they are older then 120 days)

Copied: piatti/home/piupartsm/bin/reschedule_oldest_logs (from rev 775, piatti/home/piupartsm/bin/archive_old_logs)
===================================================================
--- piatti/home/piupartsm/bin/reschedule_oldest_logs	                        (rev 0)
+++ piatti/home/piupartsm/bin/reschedule_oldest_logs	2011-04-02 10:34:53 UTC (rev 891)
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+# Copyright 2009-2011 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
+
+#
+# reschedule 100 oldest log files, if they are older then 120 days
+#
+for SECTION in $SECTIONS ; do 
+	echo $SECTION
+	cd $MASTER/$SECTION
+	# we ignore bugged here - ptyhon-bts is really the way to go
+        find pass fail -name "*.log" -mtime +120 | xargs -n99999 -s999999 ls -dtl |tail -100
+	find pass fail -name "*.log" -mtime +120 | xargs -n99999 -s999999 ls -dt |tail -100 | xargs rm 2 > /dev/null
+	echo
+	echo "#########################################################"
+	echo
+done
+

Modified: piatti/home/piupartsm/crontab
===================================================================
--- piatti/home/piupartsm/crontab	2011-02-25 09:08:28 UTC (rev 890)
+++ piatti/home/piupartsm/crontab	2011-04-02 10:34:53 UTC (rev 891)
@@ -28,6 +28,7 @@
 10 23 * * * /home/piupartsm/bin/report_untestable_packages
 20 23 * * * /home/piupartsm/bin/report_stale_reserved_packages
 25 23 * * * /home/piupartsm/bin/archive_old_logs
+25  5 * * * /home/piupartsm/bin/reschedule_oldest_logs
 
 #
 # misc




More information about the Piuparts-commits mailing list