summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_maintenance.sh
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2015-09-09 17:40:05 +0200
committerHolger Levsen <holger@layer-acht.org>2015-09-09 17:40:05 +0200
commitacaeeaa2ca4c34919a287bd7901011c49288cf56 (patch)
tree21d67e9dd267d238e85dfe524efe951eb07d583e /bin/reproducible_maintenance.sh
parent1139655eec52ac63c05df2d5dd41a681698925a5 (diff)
downloadjenkins.debian.net-acaeeaa2ca4c34919a287bd7901011c49288cf56.tar.xz
reproducible: cleanup old schroot sessions in maintenance job
Diffstat (limited to 'bin/reproducible_maintenance.sh')
-rwxr-xr-xbin/reproducible_maintenance.sh8
1 files changed, 8 insertions, 0 deletions
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