[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.45-102-g4c48ac2
Andreas Beckmann
debian at abeckmann.de
Fri Aug 3 08:51:50 UTC 2012
The following commit has been merged in the develop branch:
commit 5123590f08c6060ff34763a385ec3669f33723cd
Author: Andreas Beckmann <debian at abeckmann.de>
Date: Fri Jul 20 13:29:20 2012 +0200
reschedule_oldest_logs: link candidates to recycle/
link the log files to be recycled to recycle/ instead of deleting them
Signed-off-by: Andreas Beckmann <debian at abeckmann.de>
diff --git a/debian/changelog b/debian/changelog
index 55c7db6..2a337d9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -58,6 +58,8 @@ piuparts (0.46) UNRELEASED; urgency=low
- Separate build and install targets.
- Adjust for new layout, cleanup, simplify.
* conf/piuparts.apache: Set DefaultType text/plain (for the logfiles).
+ * reschedule_oldest_logs: Hardlink old logfiles to recycle/ instead of
+ deleting them.
* New helper script: master-bin/reclassify_bugged.
* New custom script post_setup_forbid_home: replace /home with a file to
prevent creating home directories there. (Closes: #677332)
diff --git a/master-bin/reschedule_oldest_logs b/master-bin/reschedule_oldest_logs
index 3621612..96cae94 100755
--- a/master-bin/reschedule_oldest_logs
+++ b/master-bin/reschedule_oldest_logs
@@ -50,6 +50,7 @@ get_config_value FAIL_COUNT global reschedule-fail-count 25
TOTAL=0
LOGS=`mktemp`
+LOGS2=`mktemp`
OLDPWD=$(pwd)
for SECTION in $SECTIONS ; do
test -d $MASTER/$SECTION || continue
@@ -60,16 +61,20 @@ for SECTION in $SECTIONS ; do
get_config_value _FAIL_AGE $SECTION reschedule-fail-days $FAIL_AGE
get_config_value _FAIL_COUNT $SECTION reschedule-fail-count $FAIL_COUNT
cd $MASTER/$SECTION
- mkdir -p pass fail affected
+ mkdir -p pass fail affected recycle
# FIXME: we ignore bugged here - ptyhon-bts is really the way to go
find pass fail affected -name "*.log" -mtime +$_AGE | xargs --no-run-if-empty -n99999 -s999999 ls -dt | tail -n $_COUNT > $LOGS
find fail affected -name "*.log" -mtime +$_FAIL_AGE | xargs --no-run-if-empty -n99999 -s999999 ls -dt | tail -n $_FAIL_COUNT >> $LOGS
+ sort -u $LOGS > $LOGS2
+ for log in $(cat $LOGS2) ; do
+ test -f recycle/$(basename "$log") || echo "$log"
+ done > $LOGS
if [ -s $LOGS ]; then
COUNT=$(wc -l $LOGS | awk '{ print $1 }')
TOTAL=$(($TOTAL + $COUNT))
echo "$SECTION: $COUNT"
ls -dtl $(cat $LOGS)
- sort -u $LOGS | xargs rm 2>/dev/null
+ ln -f $(cat $LOGS) recycle/
echo
echo "#########################################################"
echo
@@ -77,7 +82,7 @@ for SECTION in $SECTIONS ; do
cd $OLDPWD
fi
done
-rm $LOGS
+rm $LOGS $LOGS2
if [ "$TOTAL" -gt "0" ]; then
echo "Rescheduled $TOTAL logs"
--
piuparts git repository
More information about the Piuparts-commits
mailing list