[Piuparts-commits] [piuparts] 01/01: slave_stop: improve output and add trap support
Holger Levsen
holger at layer-acht.org
Mon Mar 6 09:31:47 UTC 2017
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to branch develop
in repository piuparts.
commit 892a99ede05d3ed177749b48e6c741f73ed8b91e
Author: Holger Levsen <holger at layer-acht.org>
Date: Mon Mar 6 10:31:32 2017 +0100
slave_stop: improve output and add trap support
Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
slave-bin/slave_stop.in | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/slave-bin/slave_stop.in b/slave-bin/slave_stop.in
index 30355e1..dc8e129 100755
--- a/slave-bin/slave_stop.in
+++ b/slave-bin/slave_stop.in
@@ -26,21 +26,30 @@ set -e
get_config_value SLAVEROOT global slave-directory
get_config_value SLAVECOUNT global slave-count 1
-pkill --signal INT --full '/usr/bin/python /srv/piuparts.debian.org/share/piuparts/piuparts-slave' &
+
+cleanup_tails() {
+ pkill --full 'tail -f screenlog.'
+}
+
cd $SLAVEROOT
+trap cleanup_tails INT TERM EXIT
for i in $(seq 1 $SLAVECOUNT) ; do
tail -f screenlog.$i &
done
+sleep 0.5
+pkill --signal INT --full '/usr/bin/python /srv/piuparts.debian.org/share/piuparts/piuparts-slave'
i=1
while pgrep --full '/usr/bin/python /srv/piuparts.debian.org/share/piuparts/piuparts-slave' > /dev/null ; do
echo -n "$(date -u +%T) - "
- pgrep --full '/usr/bin/python /srv/piuparts.debian.org/share/piuparts/piuparts-slave' | xargs -r echo "slaves running: "
- sleep $(( $i * $i ))
+ pgrep --full '/usr/bin/python /srv/piuparts.debian.org/share/piuparts/piuparts-slave' | xargs -r echo -n "slaves running: "
+ SLEEP=$(( $i * $i ))
+ echo " sleeping ${SLEEP}sec now..."
i=$(( $i + 1 ))
done
echo -n "$(date -u +%T) - "
-pgrep --full '/usr/bin/python /srv/piuparts.debian.org/share/piuparts/piuparts-slave' | xargs echo "slaves running: "
+pgrep --full '/usr/bin/python /srv/piuparts.debian.org/share/piuparts/piuparts-slave' | xargs echo "slaves running: (should list none) "
+trap - INT TERM EXIT
pkill --full 'tail -f screenlog.'
pkill --full 'SCREEN -S piuparts_slave_screen -d -m'
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git
More information about the Piuparts-commits
mailing list