Commit 5f5ca777 authored by Holger Levsen's avatar Holger Levsen
Browse files

maintenance: cleanup sbuild dirs using sudo and after 3 days already



Signed-off-by: Holger Levsen's avatarHolger Levsen <holger@layer-acht.org>
parent bdc4ca89
...@@ -396,7 +396,7 @@ if [ ! -z "$OLDSTUFF" ]; then ...@@ -396,7 +396,7 @@ if [ ! -z "$OLDSTUFF" ]; then
echo echo
echo "Warning: Tried, but failed to delete these schroot sessions:" echo "Warning: Tried, but failed to delete these schroot sessions:"
echo "$OLDSTUFF" echo "$OLDSTUFF"
echo "Manual cleanup needed" echo "Manual cleanup needed."
fi fi
echo echo
DIRTY=true DIRTY=true
...@@ -426,7 +426,7 @@ if [ "$HOSTNAME" = "$MAINNODE" ] ; then ...@@ -426,7 +426,7 @@ if [ "$HOSTNAME" = "$MAINNODE" ] ; then
echo echo
echo "Warning: Tried, but failed to delete these in $dir:" echo "Warning: Tried, but failed to delete these in $dir:"
echo "$OLDSTUFF" echo "$OLDSTUFF"
echo "Manual cleanup needed" echo "Manual cleanup needed."
fi fi
echo echo
DIRTY=true DIRTY=true
...@@ -457,7 +457,7 @@ cleanup_old_schroots() { ...@@ -457,7 +457,7 @@ cleanup_old_schroots() {
echo echo
echo "Warning: Tried, but failed to delete these $OBJECTS:" echo "Warning: Tried, but failed to delete these $OBJECTS:"
echo "$OLDSTUFF" echo "$OLDSTUFF"
echo "Manual cleanup needed!" echo "Manual cleanup needed."
fi fi
echo echo
DIRTY=true DIRTY=true
...@@ -475,7 +475,7 @@ if [ ! -z "$OLDSTUFF" ]; then ...@@ -475,7 +475,7 @@ if [ ! -z "$OLDSTUFF" ]; then
echo "Warning: schroots older than 1 month found in /schroot:" echo "Warning: schroots older than 1 month found in /schroot:"
echo "$OLDSTUFF" echo "$OLDSTUFF"
echo echo
echo "Manual cleanup needed!" echo "Manual cleanup needed."
echo echo
DIRTY=true DIRTY=true
fi fi
...@@ -483,20 +483,21 @@ fi ...@@ -483,20 +483,21 @@ fi
# remove too old sbuild directories # remove too old sbuild directories
dir=/var/lib/sbuild/build dir=/var/lib/sbuild/build
if [ -d $dir ] ; then if [ -d $dir ] ; then
echo "$(date -u) - Removing sbuild directories older than 7 days." echo "$(date -u) - Removing sbuild directories older than 3 days."
OLDSTUFF=$(find "$dir" -mindepth 1 -maxdepth 1 -type d -mtime +6 -exec ls -lad {} \;) OLDSTUFF=$(find "$dir" -mindepth 1 -maxdepth 1 -type d -mtime +6 -exec ls -lad {} \;)
if [ ! -z "$OLDSTUFF" ]; then if [ ! -z "$OLDSTUFF" ]; then
echo echo
echo "sbuild directories older than 7 days found, which will be deleted:" echo "sbuild directories older than 3 days found, which will be deleted:"
echo "$OLDSTUFF" echo "$OLDSTUFF"
echo echo
find "$dir" -mindepth 1 -maxdepth 1 -type d -mtime +6 -exec rm -r {} \; find "$dir" -mindepth 1 -maxdepth 1 -type d -mtime +2 -exec sudo rm -rf --one-file-system {} \;
OLDSTUFF=$(find "$dir" -mindepth 1 -maxdepth 1 -type d -mtime +6 -exec ls -lad {} \;) OLDSTUFF=$(find "$dir" -mindepth 1 -maxdepth 1 -type d -mtime +2 -exec ls -lad {} \;)
if [ ! -z "$OLDSTUFF" ]; then if [ ! -z "$OLDSTUFF" ]; then
echo echo
echo "Warning: Tried, but failed to delete these sbuild directories:" echo "Warning: Tried, but failed to delete these sbuild directories:"
echo "$OLDSTUFF" echo "$OLDSTUFF"
echo "Manual cleanup needed" echo
echo "Manual cleanup needed."
fi fi
echo echo
DIRTY=true DIRTY=true
......
...@@ -22,6 +22,7 @@ jenkins ALL= \ ...@@ -22,6 +22,7 @@ jenkins ALL= \
/bin/rm -rf --one-file-system /chroots/*, \ /bin/rm -rf --one-file-system /chroots/*, \
/bin/rm -rf --one-file-system /schroots/*, \ /bin/rm -rf --one-file-system /schroots/*, \
/bin/rm -rf --one-file-system /srv/workspace/pbuilder/*, \ /bin/rm -rf --one-file-system /srv/workspace/pbuilder/*, \
/bin/rm -rf --one-file-system /var/lib/sbuild/build/*, \
/bin/rm -rf --one-file-system /tmp/*, \ /bin/rm -rf --one-file-system /tmp/*, \
/bin/rm -rv --one-file-system /tmp/*, \ /bin/rm -rv --one-file-system /tmp/*, \
/bin/mv /chroots/* /schroots/*, \ /bin/mv /chroots/* /schroots/*, \
......
...@@ -18,6 +18,7 @@ jenkins ALL= \ ...@@ -18,6 +18,7 @@ jenkins ALL= \
/bin/rm -rf --one-file-system /schroots/*, \ /bin/rm -rf --one-file-system /schroots/*, \
/bin/rm -rf --one-file-system /srv/workspace/pbuilder/*, \ /bin/rm -rf --one-file-system /srv/workspace/pbuilder/*, \
/bin/rm -rf --one-file-system /srv/workspace/chroots/*, \ /bin/rm -rf --one-file-system /srv/workspace/chroots/*, \
/bin/rm -rf --one-file-system /var/lib/sbuild/build/*, \
/bin/mv /chroots/* /schroots/*, \ /bin/mv /chroots/* /schroots/*, \
/bin/mv /schroots/* /schroots/*, \ /bin/mv /schroots/* /schroots/*, \
/bin/umount -l /chroots/*, \ /bin/umount -l /chroots/*, \
......
...@@ -20,6 +20,7 @@ jenkins ALL= \ ...@@ -20,6 +20,7 @@ jenkins ALL= \
/bin/rm -rf --one-file-system /chroots/*, \ /bin/rm -rf --one-file-system /chroots/*, \
/bin/rm -rf --one-file-system /schroots/*, \ /bin/rm -rf --one-file-system /schroots/*, \
/bin/rm -rf --one-file-system /srv/workspace/pbuilder/*, \ /bin/rm -rf --one-file-system /srv/workspace/pbuilder/*, \
/bin/rm -rf --one-file-system /var/lib/sbuild/build/*, \
/bin/rm -rf --one-file-system /tmp/*, \ /bin/rm -rf --one-file-system /tmp/*, \
/bin/rm -rv --one-file-system /tmp/*, \ /bin/rm -rv --one-file-system /tmp/*, \
/bin/rm -v /var/lib/schroot/*, \ /bin/rm -v /var/lib/schroot/*, \
......
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