From 56a40ec51afb6736f9668468d9d1c73e056215f9 Mon Sep 17 00:00:00 2001 From: theonlydoo Date: Wed, 11 May 2016 17:36:55 +0200 Subject: [PATCH] Update run.sh Update to provide some more reliability on server boot time --- docker/run.sh | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/docker/run.sh b/docker/run.sh index 86f7880f24..e30eaf9f07 100644 --- a/docker/run.sh +++ b/docker/run.sh @@ -1,4 +1,28 @@ #!/bin/bash -go-cve-dictionary server & -sleep 2 -vuls scan -config /app/config.toml -report-slack +tries=0 + +function isopen { + tries=$1 + nmap -Pn -T4 -p 1323 127.0.0.1|grep -iq open + if [ $? -ne 0 ]; then + if [ $tries -lt 5 ]; then + let tries++ + startserver $tries + else + return 1 + fi + else + return 0 + fi +} +function startserver { + tries=$1 + go-cve-dictionary server & + sleep 2 + isopen $tries +} + +startserver $tries +if [ $? -ne 1 ]; then + vuls scan -config /app/config.toml -report-slack +fi