From eca679157ba53ed0af27136f3111540a895e8219 Mon Sep 17 00:00:00 2001 From: andryyy Date: Mon, 12 Dec 2016 09:26:08 +0100 Subject: [PATCH] Basic port check for build-all.sh --- port-check.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 port-check.sh diff --git a/port-check.sh b/port-check.sh new file mode 100755 index 00000000..5ab28883 --- /dev/null +++ b/port-check.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +. mailcow.conf + +for port in ${SMTP_PORT} ${SMTPS_PORT} ${SUBMISSION_PORT} ${IMAP_PORT} ${IMAPS_PORT} ${POP_PORT} ${POPS_PORT} ${SIEVE_PORT} 443; do + if [[ ! -z $(ss -tlnp "( sport = :$port )" 2> /dev/null | grep LISTEN | grep -vi docker) ]]; then + echo "Port $port is in use by other process." + err=1 + fi +done + +if [[ ${err} == "1" ]]; then + echo + echo "Exiting." + exit 1 +fi + +exit 0