[Qa-jenkins-scm] [jenkins.debian.net] 01/01: reproducible: cleanup schroot sessions before moving them away
Holger Levsen
holger at moszumanska.debian.org
Thu Sep 10 09:29:38 UTC 2015
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to branch master
in repository jenkins.debian.net.
commit 064e46b4a50e165b0046a51982dbb31617dc1389
Author: Holger Levsen <holger at layer-acht.org>
Date: Thu Sep 10 11:28:56 2015 +0200
reproducible: cleanup schroot sessions before moving them away
---
bin/schroot-create.sh | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/bin/schroot-create.sh b/bin/schroot-create.sh
index c3ffe46..5185932 100755
--- a/bin/schroot-create.sh
+++ b/bin/schroot-create.sh
@@ -181,6 +181,12 @@ bootstrap() {
fi
}
+cleanup_schroot_sessions() {
+ # FIXME: if this works well, move to _common.sh and use the same function from _maintenance.sh
+ ps fax|grep -v grep |grep schroot || for i in $(schroot --all-sessions -l ) ; do ps fax|grep -v grep |grep schroot || schroot -e -c $i ; done
+ schroot --all-sessions -l
+}
+
cleanup() {
if [ -d $CHROOT_TARGET ]; then
sudo rm -rf --one-file-system $CHROOT_TARGET || ( echo "Warning: $CHROOT_TARGET could not be fully removed on forced cleanup." ; ls $CHROOT_TARGET -la )
@@ -196,10 +202,12 @@ trap - INT TERM EXIT
rand=$RANDOM
if [ -d $SCHROOT_BASE/"$TARGET" ]
then
+ cleanup_schroot_sessions
echo "$(date -u ) - $SCHROOT_BASE/$TARGET exists, moving it away to $SCHROOT_BASE/$TARGET-$rand"
sudo mv $SCHROOT_BASE/"$TARGET" $SCHROOT_BASE/"$TARGET"-"$rand"
fi
+cleanup_schroot_sessions
echo "$(date -u ) - renaming $CHROOT_TARGET to $SCHROOT_BASE/$TARGET"
sudo mv $CHROOT_TARGET $SCHROOT_BASE/"$TARGET"
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git
More information about the Qa-jenkins-scm
mailing list