diff options
author | Holger Levsen <holger@layer-acht.org> | 2015-09-09 17:40:05 +0200 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2015-09-09 17:40:05 +0200 |
commit | acaeeaa2ca4c34919a287bd7901011c49288cf56 (patch) | |
tree | 21d67e9dd267d238e85dfe524efe951eb07d583e /bin | |
parent | 1139655eec52ac63c05df2d5dd41a681698925a5 (diff) | |
download | jenkins.debian.net-acaeeaa2ca4c34919a287bd7901011c49288cf56.tar.xz |
reproducible: cleanup old schroot sessions in maintenance job
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/reproducible_maintenance.sh | 8 |
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 |