19 lines
358 B
Nix
19 lines
358 B
Nix
{ pkgs, ... }:
|
|
|
|
pkgs.writeDashBin "untilport" ''
|
|
set -euf
|
|
|
|
usage() {
|
|
echo 'untiport $target $port'
|
|
echo 'Sleeps until the destinated port is reachable.'
|
|
echo 'ex: untilport google.de 80 && echo "google is now reachable"'
|
|
}
|
|
|
|
|
|
if [ $# -ne 2 ]; then
|
|
usage
|
|
else
|
|
until ${pkgs.netcat-openbsd}/bin/nc -z "$@"; do sleep 1; done
|
|
fi
|
|
''
|