From acaeeaa2ca4c34919a287bd7901011c49288cf56 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Wed, 9 Sep 2015 17:40:05 +0200 Subject: reproducible: cleanup old schroot sessions in maintenance job --- bin/reproducible_maintenance.sh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'bin') diff --git a/bin/reproducible_maintenance.sh b/bin/reproducible_maintenance.sh index f2a7fb30..5edbc6a0 100755 --- a/bin/reproducible_maintenance.sh +++ b/bin/reproducible_maintenance.sh @@ -51,6 +51,14 @@ if [ ! -z "$OLDSTUFF" ] ; then DIRTY=true fi +# remove old and unused schroot sessions +ps fax|grep -v grep |grep schroot || for i in $(sudo schroot --all-sessions -l ) ; do ps fax|grep -v grep |grep schroot || sudo schroot -c $i -e ; done +# to explain this: +# first, check if no process using "schroot" is running... +# then loop through all schroot sessions +# for each session +# check that schroot is still not run, and then, delete the session + # find old schroots OLDSTUFF=$(find /schroots/ -maxdepth 1 -type d -regextype posix-extended -regex "/schroots/reproducible-.*-[0-9]{1,5}" -mtime +2 -exec ls -lad {} \;) if [ ! -z "$OLDSTUFF" ] ; then -- cgit v1.2.3-70-g09d2