summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-04-10 19:11:36 +0200
committerHolger Levsen <holger@layer-acht.org>2015-04-11 15:08:32 +0200
commit2952086e79e60e15bda8101dd9b6bd76af978aee (patch)
tree3a7a849d8a6c518d6b2c7d8d6041abacdcc7c35e
parent150aab14d2cba0db59d1b09ec6c053ac07462ad7 (diff)
downloadjenkins.debian.net-2952086e79e60e15bda8101dd9b6bd76af978aee.tar.xz
reproducible: maintenance: rework a bit the "find+terminate processes which should not be there" part to avoid logparse noise
-rwxr-xr-xbin/reproducible_maintenance.sh26
1 files changed, 15 insertions, 11 deletions
diff --git a/bin/reproducible_maintenance.sh b/bin/reproducible_maintenance.sh
index 01c5f885..32ca96c5 100755
--- a/bin/reproducible_maintenance.sh
+++ b/bin/reproducible_maintenance.sh
@@ -119,6 +119,7 @@ fi
# find+terminate processes which should not be there
HAYSTACK=$(mktemp)
RESULT=$(mktemp)
+TOKILL=$(mktemp)
PBUIDS="1234 1111 2222"
ps axo pid,user,size,pcpu,cmd > $HAYSTACK
for i in $PBUIDS ; do
@@ -128,24 +129,27 @@ for i in $PBUIDS ; do
done
done
if [ -s $RESULT ] ; then
- echo
- echo "Warning: processes found which should not be there, maybe killing them now:"
- cat $RESULT
- echo
for PROCESS in $(cat $RESULT | cut -d " " -f1 | xargs echo) ; do
AGE=$(ps -p $PROCESS -o etimes= || echo 0)
# a single build may only take half a day, so...
if [ $AGE -gt 43200 ] ; then
- sudo kill -9 $PROCESS 2>&1
- echo "'kill -9 $PROCESS' done."
- else
- echo "Did not kill $PROCESS as it is only $AGE seconds old."
+ echo "$PROCESS" >> $TOKILL
fi
done
- echo
- DIRTY=true
+ if [ -s $TOKILL ] ; then
+ DIRTY=true
+ echo
+ echo "Warning: processes found which should not be there, killing them now:"
+ cat $TOKILL | xargs echo
+ echo
+ for PROCESS in $(cat $TOKILL | xargs echo) ; do
+ echo sudo kill -9 $PROCESS 2>&1
+ #echo "'kill -9 $PROCESS' done." # FIXME re-enable once we're sure this new code is fine
+ done
+ echo
+ fi
fi
-rm $HAYSTACK $RESULT
+rm $HAYSTACK $RESULT $TOKILL
# find packages which build didnt end correctly
QUERY="