diff options
author | Joseph Hunkeler <jhunkeler@users.noreply.github.com> | 2019-02-12 12:25:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-12 12:25:50 -0500 |
commit | 43933b5ec30441536b07f09a0a130624728dab77 (patch) | |
tree | eefe0aca9146ed1f66e27a98b62d3d9d3c29bd38 | |
parent | a6f0d0a38ea52a202252b871cb00e8b5f604d105 (diff) | |
parent | 7e5eec2af519441606c703f3c8ccd0fcfe63c7ff (diff) | |
download | docker-buildsys-43933b5ec30441536b07f09a0a130624728dab77.tar.gz |
Merge pull request #15 from jhunkeler/timeout-HD-die-more-edition
Improve timeout situation
-rw-r--r-- | Dockerfile | 3 | ||||
-rwxr-xr-x | spawner.sh | 9 |
2 files changed, 11 insertions, 1 deletions
@@ -91,9 +91,10 @@ RUN curl -L https://github.com/krallin/tini/releases/download/v0.18.0/tini-stati && chmod +x /usr/bin/tini ADD with_env /usr/local/bin +ADD spawner.sh /usr/local/bin WORKDIR ${HOME} EXPOSE 22 -ENTRYPOINT ["tini", "-g", "--", "timeout", "-sKILL", "45m"] +ENTRYPOINT ["tini", "-g", "--", "spawner.sh"] CMD ["/bin/bash"] 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} |