[Qa-jenkins-scm] [jenkins.debian.net] 01/01: reproducible: maintenance: rework a bit the "find+terminate processes which should not be there" part to avoid logparse noise

Holger Levsen holger at moszumanska.debian.org
Sat Apr 11 13:11:48 UTC 2015


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit 2952086e79e60e15bda8101dd9b6bd76af978aee
Author: Mattia Rizzolo <mattia at mapreri.org>
Date:   Fri Apr 10 19:11:36 2015 +0200

    reproducible: maintenance: rework a bit the "find+terminate processes which should not be there" part to avoid logparse noise
---
 bin/reproducible_maintenance.sh | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/bin/reproducible_maintenance.sh b/bin/reproducible_maintenance.sh
index 01c5f88..32ca96c 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="

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list