feat: use ss -tulnp | grep ':PORT ' instead of lsof -i :PORT

On GCP instances lsof -i gives false positive about port usage. Using ss -tulnp fixes this
This commit is contained in:
Kristóf Hauser
2024-05-01 15:53:47 +02:00
parent 440f3e7f0f
commit 31077bd2c4

View File

@@ -19,13 +19,13 @@ if [ -f /.dockerenv ]; then
fi
# check if something is running on port 80
if lsof -i :80 >/dev/null; then
if ss -tulnp | grep ':80 ' >/dev/null; then
echo "Error: something is already running on port 80" >&2
exit 1
fi
# check if something is running on port 443
if lsof -i :443 >/dev/null; then
if ss -tulnp | grep ':443 ' >/dev/null; then
echo "Error: something is already running on port 443" >&2
exit 1
fi