Check if port 80 is free before starting during install

This commit is contained in:
Ondřej Nový 2020-06-05 09:47:08 +02:00
parent d9b51eb2ed
commit cc65b80eb0
4 changed files with 21 additions and 3 deletions

3
debian/control vendored
View file

@ -75,6 +75,7 @@ Depends: libnginx-mod-http-geoip (= ${binary:Version}),
libnginx-mod-stream (= ${binary:Version}),
libnginx-mod-stream-geoip (= ${binary:Version}),
nginx-common (= ${source:Version}),
iproute2,
${misc:Depends},
${shlibs:Depends}
Breaks: nginx (<< 1.4.5-1),
@ -150,6 +151,7 @@ Package: nginx-light
Architecture: any
Depends: libnginx-mod-http-echo (= ${binary:Version}),
nginx-common (= ${source:Version}),
iproute2,
${misc:Depends},
${shlibs:Depends}
Breaks: nginx (<< 1.4.5-1)
@ -196,6 +198,7 @@ Depends: libnginx-mod-http-auth-pam (= ${binary:Version}),
libnginx-mod-stream-geoip (= ${binary:Version}),
libnginx-mod-stream-geoip2 (= ${binary:Version}),
nginx-common (= ${source:Version}),
iproute2,
${misc:Depends},
${shlibs:Depends}
Breaks: nginx (<< 1.4.5-1)

View file

@ -24,7 +24,12 @@ if [ -x /etc/init.d/nginx ]; then
invoke-rc.d nginx upgrade || invoke-rc.d nginx restart
exit $?
else
invoke-rc.d nginx start || exit $?
if [ -z "$(ss -nlt 'sport = 80' | grep -v ^State)" ]; then
invoke-rc.d nginx start || exit $?
else
echo "Not attempting to start NGINX, port 80 is already in use."
exit 0
fi
fi
fi

View file

@ -24,7 +24,12 @@ if [ -x /etc/init.d/nginx ]; then
invoke-rc.d nginx upgrade || invoke-rc.d nginx restart
exit $?
else
invoke-rc.d nginx start || exit $?
if [ -z "$(ss -nlt 'sport = 80' | grep -v ^State)" ]; then
invoke-rc.d nginx start || exit $?
else
echo "Not attempting to start NGINX, port 80 is already in use."
exit 0
fi
fi
fi

View file

@ -24,7 +24,12 @@ if [ -x /etc/init.d/nginx ]; then
invoke-rc.d nginx upgrade || invoke-rc.d nginx restart
exit $?
else
invoke-rc.d nginx start || exit $?
if [ -z "$(ss -nlt 'sport = 80' | grep -v ^State)" ]; then
invoke-rc.d nginx start || exit $?
else
echo "Not attempting to start NGINX, port 80 is already in use."
exit 0
fi
fi
fi