summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple/untilport/default.nix
blob: d299ec807b5897447daaedabdd494724cacc9443 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{ libressl, writeDashBin, ... }:

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 ${libressl.nc}/bin/nc -z "$@"; do sleep 1; done
  fi
''