reproducible debian: move cleanup_schroot_sessions() from common-functions to...

reproducible debian: move cleanup_schroot_sessions() from common-functions to _mainteanance, as it's used only there now
Signed-off-by: Mattia Rizzolo's avatarMattia Rizzolo <mattia@debian.org>
parent b61dbb2b
......@@ -224,29 +224,3 @@ publish_changes_to_userContent() {
kgb-client --conf /srv/jenkins/kgb/$CHANNEL.conf --relay-msg "$MESSAGE"
fi
}
cleanup_schroot_sessions() {
echo
local RESULT=""
for loop in $(seq 0 40) ; do
# first, check if no process using "schroot" is running, if thats the case, loop through all schroot sessions:
# arch sessions are ignored, because they are handled properly
pgrep -f "schroot --directory" || for i in $(schroot --all-sessions -l |grep -v "session:archlinux"||true) ; do
# then, check that schroot is still not run, and then delete the session
if [ -z $i ] ; then
continue
fi
pgrep -f "schroot --directory" || schroot -e -c $i
done
RESULT=$(schroot --all-sessions -l|grep -v "session:archlinux"||true)
if [ -z "$RESULT" ] ; then
echo "No schroot sessions in use atm..."
echo
break
fi
echo "$(date -u) - schroot session cleanup loop $loop"
sleep 15
done
echo
}
#!/bin/bash
# Copyright 2014-2017 Holger Levsen <holger@layer-acht.org>
# © 2015-2017 Mattia Rizzolo <mattia@mapreri.org>
# © 2015-2018 Mattia Rizzolo <mattia@debian.org>
# released under the GPLv=2
DEBUG=false
......@@ -187,6 +187,30 @@ fi
# remove old and unused schroot sessions
echo "$(date -u) - Removing unused schroot sessions."
cleanup_schroot_sessions() {
echo
local RESULT=""
for loop in $(seq 0 40) ; do
# first, check if no process using "schroot" is running, if thats the case, loop through all schroot sessions:
# arch sessions are ignored, because they are handled properly
pgrep -f "schroot --directory" || for i in $(schroot --all-sessions -l |grep -v "session:archlinux"||true) ; do
# then, check that schroot is still not run, and then delete the session
if [ -z $i ] ; then
continue
fi
pgrep -f "schroot --directory" || schroot -e -c $i
done
RESULT=$(schroot --all-sessions -l|grep -v "session:archlinux"||true)
if [ -z "$RESULT" ] ; then
echo "No schroot sessions in use atm..."
echo
break
fi
echo "$(date -u) - schroot session cleanup loop $loop"
sleep 15
done
echo
}
cleanup_schroot_sessions
# find old schroots
......
Markdown is supported
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