[Qa-jenkins-scm] [jenkins.debian.net] 01/02: reproducible: replace 'ps fax|grep -v grep|grep foo' with 'pgrep -f foo'

Holger Levsen holger at moszumanska.debian.org
Mon Oct 5 12:30:16 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 76c746024d8ba163e52f0f26e0bf8c20a4d69399
Author: Holger Levsen <holger at layer-acht.org>
Date:   Mon Oct 5 14:26:58 2015 +0200

    reproducible: replace 'ps fax|grep -v grep|grep foo' with 'pgrep -f foo'
---
 bin/reproducible_maintenance.sh | 2 +-
 bin/schroot-create.sh           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/reproducible_maintenance.sh b/bin/reproducible_maintenance.sh
index a8ef120..156e6b7 100755
--- a/bin/reproducible_maintenance.sh
+++ b/bin/reproducible_maintenance.sh
@@ -114,7 +114,7 @@ fi
 
 # remove old and unused schroot sessions
 echo "$(date -u) - Removing unused schroot sessions."
-ps fax|grep -v grep |grep "schroot --directory" || for i in $(schroot --all-sessions -l ) ; do ps fax|grep -v grep |grep "schroot --directory" || schroot -e -c $i ; done
+pgrep -f "schroot --directory" || for i in $(schroot --all-sessions -l ) ; do pgrep -f "schroot --directory" || schroot -e -c $i ; done
 # to explain this:
 # first, check if no process using "schroot" is running...
 # then loop through all schroot sessions
diff --git a/bin/schroot-create.sh b/bin/schroot-create.sh
index aff86ec..9999ca6 100755
--- a/bin/schroot-create.sh
+++ b/bin/schroot-create.sh
@@ -187,7 +187,7 @@ cleanup_schroot_sessions() {
 	# FIXME: if this works well, move to _common.sh and use the same function from _maintenance.sh
 	local RESULT=""
 	for loop in $(seq 0 40) ; do
-		ps fax|grep -v grep | grep -v schroot-create.sh |grep "schroot --directory" || for i in $(schroot --all-sessions -l ) ; do ps fax|grep -v grep |grep -v schroot-create.sh | grep "schroot --directory" || schroot -e -c $i ; done
+		pgrep -f "schroot --directory" || for i in $(schroot --all-sessions -l ) ; do pgrep -f "schroot --directory" || schroot -e -c $i ; done
 		RESULT=$(schroot --all-sessions -l)
 		if [ -z "$RESULT" ] ; then
 			echo "No schroot sessions in use atm..."

-- 
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