[Piuparts-commits] [SCM] piatti.debian.org configuration files branch, master, updated. 148332ef45997ba3aaf38cc2c9a28441083bad49
Andreas Beckmann
debian at abeckmann.de
Fri Dec 23 10:24:23 UTC 2011
The following commit has been merged in the master branch:
commit bd02f79e5e22e007383cd7a222a8d21c136b0d95
Author: Andreas Beckmann <debian at abeckmann.de>
Date: Wed Nov 30 14:59:14 2011 +0100
reschedule_oldest: improve configurability
Allow the age and timeout values to be overridden in the config
file. Do not produce output for empty file lists.
Signed-off-by: Andreas Beckmann <debian at abeckmann.de>
diff --git a/home/piupartsm/bin/reschedule_oldest_logs b/home/piupartsm/bin/reschedule_oldest_logs
index 789f194..282f92a 100755
--- a/home/piupartsm/bin/reschedule_oldest_logs
+++ b/home/piupartsm/bin/reschedule_oldest_logs
@@ -39,29 +39,33 @@ get_config_value()
get_config_value MASTER global master-directory
get_config_value SECTIONS global sections
-
-AGE=180
-COUNT=200
-FAIL_AGE=30
-FAIL_COUNT=25
#
# 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
#
+get_config_value AGE global reschedule-old-days 180
+get_config_value COUNT global reschedule-old-count 200
+get_config_value FAIL_AGE global reschedule-fail-days 30
+get_config_value FAIL_COUNT global reschedule-fail-count 25
+
+LOGS=`mktemp`
+OLDPWD=$(pwd)
for SECTION in $SECTIONS ; do
- DISTRO=$(sed -rn '\#\['"$SECTION"'\]#,/^\[/ {s/^distro\s*=\s*//p}' /etc/piuparts/piuparts.conf)
- # only for sid and wheezy
- if [ "$DISTRO" = "sid" ] || [ "$DISTRO" = "wheezy" ] || [ "$DISTRO" = "experimental" ]; then
- echo $SECTION
+ get_config_value RESCHEDULE $SECTION auto-reschedule yes
+ if [ "$RESCHEDULE" = "yes" ]; then
cd $MASTER/$SECTION
# we ignore bugged here - ptyhon-bts is really the way to go
- find pass fail -name "*.log" -mtime +$AGE | xargs -n99999 -s999999 ls -dtl | tail -n $COUNT
- find pass fail -name "*.log" -mtime +$AGE | xargs -n99999 -s999999 ls -dt | tail -n $COUNT | xargs rm 2> /dev/null
- find fail -name "*.log" -mtime +$FAIL_AGE | xargs -n99999 -s999999 ls -dtl | tail -n $FAIL_COUNT
- find fail -name "*.log" -mtime +$FAIL_AGE | xargs -n99999 -s999999 ls -dt | tail -n $FAIL_COUNT | xargs rm 2> /dev/null
- echo
- echo "#########################################################"
- echo
+ find pass fail -name "*.log" -mtime +$AGE | xargs --no-run-if-empty -n99999 -s999999 ls -dt | tail -n $COUNT > $LOGS
+ find fail -name "*.log" -mtime +$FAIL_AGE | xargs --no-run-if-empty -n99999 -s999999 ls -dt | tail -n $FAIL_COUNT >> $LOGS
+ if [ -s $LOGS ]; then
+ echo $SECTION
+ ls -dtl $(cat $LOGS)
+ sort -u $LOGS | xargs rm 2>/dev/null
+ echo
+ echo "#########################################################"
+ echo
+ fi
+ cd $OLDPWD
fi
done
-
+rm $LOGS
--
piatti.debian.org configuration files
More information about the Piuparts-commits
mailing list