stockholm/krebs/5pkgs/simple/untilport/default.nix

19 lines
355 B
Nix
Raw Normal View History

2016-05-19 22:12:43 +00:00
{ 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
2022-03-23 14:05:42 +00:00
until ${pkgs.libressl.nc}/bin/nc -z "$@"; do sleep 1; done
2016-05-19 22:12:43 +00:00
fi
''