From cc49a8c9ca40eaf0dce444c3028f88de89f9578f Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 12 Feb 2019 12:01:23 -0500 Subject: Improve timeout situation drastically --- Dockerfile | 3 ++- spawner.sh | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100755 spawner.sh diff --git a/Dockerfile b/Dockerfile index 5287058..13fc91a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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..7fd328b --- /dev/null +++ b/spawner.sh @@ -0,0 +1,9 @@ +#!/bin/bash +limit="${TIMEOUT:-45m}" +echo "This job will automatically terminate after: ${limit}" +timeout -sTERM ${limit} $@ +retval=$? +if [[ ${retval} == 124 ]]; then + echo "Job terminated: ${limit} time limit reached" +fi +exit ${retval} -- cgit