[Git][qa/jenkins.debian.net][master] reproducible debian: avoid filtering out ourselves from running

Mattia Rizzolo (@mattia) gitlab at salsa.debian.org
Sat Mar 9 20:15:49 GMT 2024



Mattia Rizzolo pushed to branch master at Debian QA / jenkins.debian.net


Commits:
06dde8f8 by Mattia Rizzolo at 2024-03-09T21:12:23+01:00
reproducible debian: avoid filtering out ourselves from running

I can't quite imagine why it has worked well till now.

This was the original code before today:
 RUNNING=$(ps fax|grep -v grep|grep "$0 $1 ")
 if [ -z "$RUNNING" ] ; then
        echo "$(date --utc) - '$0 $1' already running, thus stopping this."
        exit
 fi
And it didn't have any filtering for itself either…

Signed-off-by: Mattia Rizzolo <mattia at debian.org>

- - - - -


1 changed file:

- bin/reproducible_worker.sh


Changes:

=====================================
bin/reproducible_worker.sh
=====================================
@@ -135,8 +135,13 @@ main_loop() {
 #
 # check if we really should be running
 #
-if pgrep -f "$0 $1" >/dev/null ; then
-	echo "$(date --utc) - '$0 $1' already running:"
+myself=$$
+#no idea why this doesn't work but splitting like done below does
+#PGREP_OUT=$(pgrep -f "$0 $1" |grep -v $myself)
+PGREP_OUT=$(pgrep -f "$0 $1")
+PGREP_OUT=$(echo "$PGREP_OUT" | grep -v $myself)
+if [ -n "$PGREP_OUT" ]; then
+	echo "$(date --utc) - '$0 $1' already running (I'm $myself):"
 	pgrep -f -a "$0 $1"
 	echo "$(date --utc) - stopping the current process."
 	exit 10



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/06dde8f8d96a617e5cfdb33b5316776af09ca01c

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/06dde8f8d96a617e5cfdb33b5316776af09ca01c
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20240309/1623913b/attachment-0001.htm>


More information about the Qa-jenkins-scm mailing list