From 2b9ce85ba880684a3d6f44a80748fd0dc5463c24 Mon Sep 17 00:00:00 2001 From: Toilal Date: Sat, 4 Apr 2015 17:44:14 +0200 Subject: [PATCH] Use netcat to check if mailinabox webservice is available --- setup/management.sh | 5 +---- setup/start.sh | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/setup/management.sh b/setup/management.sh index fe71385f..62034f4a 100755 --- a/setup/management.sh +++ b/setup/management.sh @@ -41,8 +41,5 @@ EOF chmod +x /etc/cron.daily/mailinabox-statuschecks -# Start it. Remove the api key file first so that start.sh -# can wait for it to be created to know that the management -# server is ready. -rm -f /var/lib/mailinabox/api.key +# Start it. restart_service mailinabox diff --git a/setup/start.sh b/setup/start.sh index fc0855b3..10c9afa2 100755 --- a/setup/start.sh +++ b/setup/start.sh @@ -72,7 +72,8 @@ if [ ! -z "$IS_DOCKER" ]; then fi # Ping the management daemon to write the DNS and nginx configuration files. -while [ ! -f /var/lib/mailinabox/api.key ]; do +until nc -z -w 4 localhost 10222 +do echo Waiting for the Mail-in-a-Box management daemon to start... sleep 2 done