qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH RESEND 1/2] scripts: helper to keep console aliv


From: Philippe Mathieu-Daudé
Subject: [Qemu-devel] [RFC PATCH RESEND 1/2] scripts: helper to keep console alive
Date: Thu, 13 Jul 2017 07:03:10 -0300

useful to avoid Travis CI jobs getting killed after 10min of inactivity.

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
 MAINTAINERS          |  1 +
 scripts/aliveness.sh | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)
 create mode 100755 scripts/aliveness.sh

diff --git a/MAINTAINERS b/MAINTAINERS
index 9529c9484c..c39f418a13 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1866,6 +1866,7 @@ S: Maintained
 F: .travis.yml
 F: .shippable.yml
 F: tests/docker/
+F: scripts/aliveness.sh
 W: https://travis-ci.org/qemu/qemu
 W: https://app.shippable.com/github/qemu/qemu
 W: http://patchew.org/QEMU/
diff --git a/scripts/aliveness.sh b/scripts/aliveness.sh
new file mode 100755
index 0000000000..1c2b6136b9
--- /dev/null
+++ b/scripts/aliveness.sh
@@ -0,0 +1,32 @@
+#! /usr/bin/env sh
+#
+# Send an "Alive!" message regularly to stderr
+#
+# Copyright (C) 2017 Philippe Mathieu-Daudé
+#
+# Author: Philippe Mathieu-Daudé <address@hidden>
+#
+# This work is licensed under the terms of the GNU LGPL, version 2+.
+# See the COPYING file in the top-level directory.
+
+TIMEOUT_S=$1
+shift 1
+{
+  set -e
+  while true
+  do
+    sleep ${TIMEOUT_S}
+    echo "Alive!" >&2
+  done
+} &
+WATCHDOG_PID=$!
+
+cleanup() {
+    echo "killing watchdog ${WATCHDOG_PID}" >&2
+    kill -TERM ${WATCHDOG_PID}
+    exit $((1 - $#))
+}
+trap cleanup INT
+
+$*
+cleanup 0
-- 
2.13.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]