[Piuparts-commits] [piuparts] 01/01: reschedule_oldest_logs.in: measure runtime.
Holger Levsen
holger at layer-acht.org
Thu Mar 9 09:48:41 UTC 2017
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to branch develop
in repository piuparts.
commit 2ba2f6b0398958fb89befa285e62a522eed6d43c
Author: Holger Levsen <holger at layer-acht.org>
Date: Thu Mar 9 10:46:23 2017 +0100
reschedule_oldest_logs.in: measure runtime.
Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
debian/changelog | 1 +
master-bin/reschedule_oldest_logs.in | 31 +++++++++++++++++++++----------
2 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index f0cae69..cfd3a58 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -83,6 +83,7 @@ piuparts (0.76) UNRELEASED; urgency=medium
* generate_daily_report.in: measure runtime of this script and the scripts
started by it.
* detect_(network|piuparts|archive)_issues.in: measure runtimes too.
+ * reschedule_oldest_logs.in: measure runtime.
[ Michael Stapelberg ]
* Add support for logging update-alternatives calls using optional
diff --git a/master-bin/reschedule_oldest_logs.in b/master-bin/reschedule_oldest_logs.in
index b7fd436..0b69744 100755
--- a/master-bin/reschedule_oldest_logs.in
+++ b/master-bin/reschedule_oldest_logs.in
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2009-2011 Holger Levsen (holger at layer-acht.org)
+# Copyright © 2009-2017 Holger Levsen (holger at layer-acht.org)
# Copyright © 2011-2012 Andreas Beckmann (anbe at debian.org)
#
# This program is free software; you can redistribute it and/or modify it
@@ -23,6 +23,9 @@
get_config_value MASTER global master-directory
get_config_value SECTIONS global sections
+STARTDATE=$(date -u +%s)
+OUTPUT=$(mktemp)
+
#
# reschedule 200 oldest log files, if they are older than 180 days
# reschedule 25 oldest fail log files, if they are older than 30 days
@@ -142,25 +145,25 @@ for SECTION in $SECTIONS ; do
TOTAL_EXPIRED=$(($TOTAL_EXPIRED + $ECOUNT))
UCOUNT=$(wc -l $OBSOLETE | awk '{ print $1 }')
UNSCHEDULE=$(($UNSCHEDULE + $UCOUNT))
- echo "$SECTION: $RCOUNT rescheduled, $ECOUNT expired, $UCOUNT obsolete${recycle_was_idle:+ (recycle-was-${recycle_was_idle})}"
+ echo "$SECTION: $RCOUNT rescheduled, $ECOUNT expired, $UCOUNT obsolete${recycle_was_idle:+ (recycle-was-${recycle_was_idle})}" >> $OUTPUT
if [ -s $LOGS ]; then
- ls -dtl $(cat $LOGS)
+ ls -dtl $(cat $LOGS) >> $OUTPUT
ln -f $(cat $LOGS) recycle/
fi
if [ -s $EXPIRED ]; then
- ls -dtl $(cat $EXPIRED)
- rm -fv $(cat $EXPIRED)
+ ls -dtl $(cat $EXPIRED) >> $OUTPUT
+ rm -fv $(cat $EXPIRED) >> $OUTPUT
fi
if [ -s $OBSOLETE ]; then
- rm -fv $(cat $OBSOLETE)
+ rm -fv $(cat $OBSOLETE) >> $OUTPUT
fi
find recycle/ -name '*.log' > $QUEUED
NUM_QUEUED=$(wc -l < $QUEUED)
TOTAL_QUEUED=$(($TOTAL_QUEUED + $NUM_QUEUED))
- echo "queued: $NUM_QUEUED$(is_recent idle.stamp || echo " not-idle")"
- echo
- echo "#########################################################"
- echo
+ echo "queued: $NUM_QUEUED$(is_recent idle.stamp || echo " not-idle")" >> $OUTPUT
+ echo >> $OUTPUT
+ echo "#########################################################" >> $OUTPUT
+ echo >> $OUTPUT
fi
cd $OLDPWD
done
@@ -172,6 +175,11 @@ rm $EXPIRED
rm $UNSORTED
rm $QUEUED
+FINALDATE=$(date -u +%s)
+RUNTIME=$(date -u -d "0 $FINALDATE seconds - $STARTDATE seconds" +%T)
+echo "Runtime: $RUNTIME"
+echo
+
if [ "$TOTAL" -gt "0" ]; then
echo "Rescheduled $TOTAL logs."
fi
@@ -184,3 +192,6 @@ fi
if [ "$TOTAL_QUEUED" -gt "0" ]; then
echo "Queued logs: $TOTAL_QUEUED"
fi
+
+cat $OUTPUT
+rm -f $OUTPUT
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git
More information about the Piuparts-commits
mailing list