Commit 9f58a8df authored by Holger Levsen's avatar Holger Levsen
Browse files

reproducible maintenance: try to unmount mount points before cleaning up old chroots



Signed-off-by: Holger Levsen's avatarHolger Levsen <holger@layer-acht.org>
parent 386c834d
...@@ -412,6 +412,12 @@ echo "$(date -u) - Removing schroots older than 3 days." ...@@ -412,6 +412,12 @@ echo "$(date -u) - Removing schroots older than 3 days."
regex="/schroots/(reproducible-.+-[0-9]{1,5}|schroot-install-.+)" regex="/schroots/(reproducible-.+-[0-9]{1,5}|schroot-install-.+)"
OLDSTUFF=$(find /schroots/ -maxdepth 1 -type d -regextype posix-extended -regex "$regex" -mtime +2 -exec ls -lad {} \; || true) OLDSTUFF=$(find /schroots/ -maxdepth 1 -type d -regextype posix-extended -regex "$regex" -mtime +2 -exec ls -lad {} \; || true)
if [ ! -z "$OLDSTUFF" ] ; then if [ ! -z "$OLDSTUFF" ] ; then
# try to unmount mounts first
for MP in $(find /schroots/ -maxdepth 1 -type d -regextype posix-extended -regex "$regex" -mtime +2 ) ; do
if [ -d $MP/proc ] ; then
sudo umount -l $MP/proc 2>/dev/null
fi
done
echo echo
echo "schroots older than 3 days found in /schroots, which will be deleted:" echo "schroots older than 3 days found in /schroots, which will be deleted:"
find /schroots/ -maxdepth 1 -type d -regextype posix-extended -regex "$regex" -mtime +2 -exec sudo rm -rf --one-file-system {} \; || true find /schroots/ -maxdepth 1 -type d -regextype posix-extended -regex "$regex" -mtime +2 -exec sudo rm -rf --one-file-system {} \; || true
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment