From ce17c12ca291a708f26d9d5a2943f86fb4115adf 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 [JT added installing netcat-openbsd in system.sh] --- setup/management.sh | 5 +---- setup/start.sh | 3 ++- setup/system.sh | 3 ++- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/setup/management.sh b/setup/management.sh index f07d862d..67daf5f9 100755 --- a/setup/management.sh +++ b/setup/management.sh @@ -42,8 +42,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 a7bf9328..8dd3f3ac 100755 --- a/setup/start.sh +++ b/setup/start.sh @@ -103,7 +103,8 @@ source setup/management.sh source setup/munin.sh # 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 diff --git a/setup/system.sh b/setup/system.sh index 55612b9d..4bc1cfaa 100755 --- a/setup/system.sh +++ b/setup/system.sh @@ -36,13 +36,14 @@ apt_get_quiet upgrade # * cron: Runs background processes periodically. # * ntp: keeps the system time correct # * fail2ban: scans log files for repeated failed login attempts and blocks the remote IP at the firewall +# * netcat-openbsd: `nc` command line networking tool # * git: we install some things directly from github # * sudo: allows privileged users to execute commands as root without being root # * coreutils: includes `nproc` tool to report number of processors # * bc: allows us to do math to compute sane defaults apt_install python3 python3-dev python3-pip \ - wget curl git sudo coreutils bc \ + netcat-openbsd wget curl git sudo coreutils bc \ haveged unattended-upgrades cron ntp fail2ban # Allow apt to install system updates automatically every day.