3 # return next free port for key
5 # usage: $OMD_ROOT/lib/port_is_used APACHE_TCP_PORT 5000
11 for S
in $
(ls /omd
/sites
); do
12 if [ ! -d /omd
/sites
/$S ]; then
15 conf
=/omd
/sites
/$S/etc
/omd
/site.conf
16 if [ "${S}" = "${OMD_SITE}" ]; then
17 if [ $
(env |
grep ^CONFIG_ |
grep "=${PORT}$" |
grep -v CONFIG_
${KEY} |
wc -l) -gt 0 ]; then
21 if ! ls $conf >/dev
/null
2>&1; then
22 echo "ERROR: Failed to read config of site ${S}. ${KEY} port will possibly be allocated twice" >&2
25 if [ $
(grep -v ^
# < $conf | grep "='${PORT}'" | wc -l) -gt 0 ]; then
35 while port_is_used
"$KEY" "$PORT"; do