Commit d0a30cf1 authored by Holger Levsen's avatar Holger Levsen
Browse files

reproducible maintenance: use and allow sudo to cleanup diffoscope schroot sessions



Signed-off-by: Holger Levsen's avatarHolger Levsen <holger@layer-acht.org>
parent dacf5211
...@@ -416,31 +416,33 @@ if [ ! -z "$OLDSTUFF" ]; then ...@@ -416,31 +416,33 @@ if [ ! -z "$OLDSTUFF" ]; then
fi fi
# remove too old schroot session data from diffoscope # remove too old schroot session data from diffoscope
echo "$(date -u) - Removing diffoscope schroot session data older than 3 days." if [ "$HOSTNAME" = "$MAINNODE" ] ; then
for path in session union/underlay union/overlay ; do echo "$(date -u) - Removing diffoscope schroot session data older than 3 days."
dir=/var/lib/schroot/$path/ for path in session union/underlay union/overlay ; do
OLDSTUFF=$(find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type d -mtime +2 -exec ls -lad {} \;) dir=/var/lib/schroot/$path/
if [ ! -z "$OLDSTUFF" ]; then
echo
echo "data in $dir older than 3 days found, which will be deleted:"
echo "$OLDSTUFF"
echo
if [ "$path" = "session" ] ; then
find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type d -mtime +2 -exec rm -v {} \;
else
find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type d -mtime +2 -exec rmdir -v {} \;
fi
OLDSTUFF=$(find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type d -mtime +2 -exec ls -lad {} \;) OLDSTUFF=$(find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -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 in $dir:" echo "data in $dir older than 3 days found, which will be deleted:"
echo "$OLDSTUFF" echo "$OLDSTUFF"
echo "Manual cleanup needed" echo
if [ "$path" = "session" ] ; then
find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type d -mtime +2 -exec sudo rm -v {} \;
else
find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type d -mtime +2 -exec sudo rmdir -v {} \;
fi
OLDSTUFF=$(find "$dir" -name "jenkins-reproducible-*-diffoscope-*" -mindepth 1 -maxdepth 1 -type d -mtime +2 -exec ls -lad {} \;)
if [ ! -z "$OLDSTUFF" ]; then
echo
echo "Warning: Tried, but failed to delete these in $dir:"
echo "$OLDSTUFF"
echo "Manual cleanup needed"
fi
echo
DIRTY=true
fi fi
echo done
DIRTY=true fi
fi
done
# find old schroots # find old schroots
echo "$(date -u) - Removing schroots older than 3 days." echo "$(date -u) - Removing schroots older than 3 days."
......
...@@ -22,6 +22,8 @@ jenkins ALL= \ ...@@ -22,6 +22,8 @@ jenkins ALL= \
/bin/rm -rf --one-file-system /srv/workspace/pbuilder/*, \ /bin/rm -rf --one-file-system /srv/workspace/pbuilder/*, \
/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/rmdir -v /var/lib/schroot/*, \
/bin/mv /chroots/* /schroots/*, \ /bin/mv /chroots/* /schroots/*, \
/bin/mv /schroots/* /schroots/*, \ /bin/mv /schroots/* /schroots/*, \
/bin/umount -l /chroots/*, \ /bin/umount -l /chroots/*, \
......
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