From 3fea8d651f49ac6a57f99bc6b49a5689e3c74fd8 Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 20 May 2016 00:12:43 +0200 Subject: l: add untilport --- lass/5pkgs/untilport/default.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 lass/5pkgs/untilport/default.nix (limited to 'lass/5pkgs/untilport/default.nix') diff --git a/lass/5pkgs/untilport/default.nix b/lass/5pkgs/untilport/default.nix new file mode 100644 index 000000000..61bcc2b89 --- /dev/null +++ b/lass/5pkgs/untilport/default.nix @@ -0,0 +1,18 @@ +{ 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 +'' -- cgit v1.2.3 [cgit] Unable to lock slot /tmp/cgit/9c200000.lock: No such file or directory (2)