summaryrefslogtreecommitdiff
path: root/spawner.sh
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@users.noreply.github.com>2019-02-12 12:25:50 -0500
committerGitHub <noreply@github.com>2019-02-12 12:25:50 -0500
commit43933b5ec30441536b07f09a0a130624728dab77 (patch)
treeeefe0aca9146ed1f66e27a98b62d3d9d3c29bd38 /spawner.sh
parenta6f0d0a38ea52a202252b871cb00e8b5f604d105 (diff)
parent7e5eec2af519441606c703f3c8ccd0fcfe63c7ff (diff)
downloaddocker-buildsys-43933b5ec30441536b07f09a0a130624728dab77.tar.gz
Merge pull request #15 from jhunkeler/timeout-HD-die-more-edition
Improve timeout situation
Diffstat (limited to 'spawner.sh')
-rwxr-xr-xspawner.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/spawner.sh b/spawner.sh
new file mode 100755
index 0000000..10553d7
--- /dev/null
+++ b/spawner.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+limit="${TIMEOUT:-45m}"
+echo "This job will automatically terminate after: ${limit}"
+timeout -sKILL ${limit} $@
+retval=$?
+if [[ ${retval} == 124 ]] || [[ ${retval} == 137 ]]; then
+ echo "Job terminated: ${limit} time limit reached"
+fi
+exit ${retval}