From 5a487053f92e45622e0ec4c48e9346de445ae0a4 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Tue, 22 Sep 2015 20:19:27 +0200 Subject: reproducible: improve code to check whether a schroot is in use --- 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 d466d2eb..c4ec831f 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 || for i in $(schroot --all-sessions -l ) ; do ps fax|grep -v grep |grep schroot || schroot -e -c $i ; done +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 # 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 0f666ab8..d0deea9e 100755 --- a/bin/schroot-create.sh +++ b/bin/schroot-create.sh @@ -186,7 +186,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 || for i in $(schroot --all-sessions -l ) ; do ps fax|grep -v grep |grep -v schroot-create.sh | grep schroot || schroot -e -c $i ; done + 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 RESULT=$(schroot --all-sessions -l) if [ -z "$RESULT" ] ; then echo "No schroot sessions in use atm..." -- cgit v1.2.3-54-g00ecf