From 018f9a51dea008c3f506c8f40c963e7afebd7b81 Mon Sep 17 00:00:00 2001
From: "egon w. stemle" <egon@iiegn.eu>
Date: Mon, 22 Jul 2019 12:58:29 +0200
Subject: [PATCH] Force exit on individual healthcheck commands

We use `timeout` from the coreutils package (should be part of many basic
installations - maybe with a different name) to force the individual
healthcheck commands too exit after a predefined timeout (300s); if this
doesn't help, send a SIGKILL.

This should help with the initial problem of hanging. A next step should
be to catch the `timeout` invoked exit and log this as an exceptional
happening.

Address #60
---
 dockerfiles/commul-customization/entrypoint.sh | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/dockerfiles/commul-customization/entrypoint.sh b/dockerfiles/commul-customization/entrypoint.sh
index fe0ca46..5587f79 100644
--- a/dockerfiles/commul-customization/entrypoint.sh
+++ b/dockerfiles/commul-customization/entrypoint.sh
@@ -20,13 +20,13 @@ make init_statistics
 # https://ubuntuforums.org/showthread.php?t=979694
 # Start process in the background and send its output to file descriptor 3
 exec 3< <(while (true); do
-    make update_oai
-    make update_statistics
-    make update_sitemap
-    make lift_embargos
-    make update_openaire_cache
-    make update_discovery
-    make send_info
+    timeout -k 30 300 make update_oai
+    timeout -k 30 300 make update_statistics
+    timeout -k 30 300 make update_sitemap
+    timeout -k 30 300 make lift_embargos
+    timeout -k 30 300 make update_openaire_cache
+    timeout -k 30 300 make update_discovery
+    timeout -k 30 300 make send_info
     echo "INIT DONE."
     sleep 86400
 done)
-- 
GitLab