summaryrefslogtreecommitdiffstats
path: root/bin/common-functions.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/common-functions.sh')
-rwxr-xr-xbin/common-functions.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/bin/common-functions.sh b/bin/common-functions.sh
index 043ef5e7..8118812f 100755
--- a/bin/common-functions.sh
+++ b/bin/common-functions.sh
@@ -127,3 +127,24 @@ publish_changes_to_userContent(){
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:
+ pgrep -f "schroot --directory" || for i in $(schroot --all-sessions -l ) ; do
+ # then, check that schroot is still not run, and then delete the session
+ pgrep -f "schroot --directory" || schroot -e -c $i
+ done
+ RESULT=$(schroot --all-sessions -l)
+ 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
+}
+