Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Seriously?

    is_ready() {
        while ! nc -z $1 $2; do
            echo "Waiting for $1:$2..."
            sleep 1
        done
        echo "$1:$2 is accessible."
    }

    is_ready google.com 443 &
    is_ready x.com 443 &
    wait


This can certainly be zero dependency :)

Replace the use of netcat with pure bash to test a tcp (or udp) connection: </dev/tcp/$1/$2


is_ready is an alternative to this.

I built it for many reasons: - Most docker images do not contain netcat so you would have to download one of them in any case. - In the case of is_ready, you won't have to write this script yourself. - Repositories like this had a lot of traffic so I supposed that engineers need a similar tool but this repository requires wget and netcat as dependencies. For this reason, I built my own without any dependencies. https://github.com/eficode/wait-for




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: