summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/untilport/default.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2017-04-25 11:05:58 +0200
committermakefu <github@syntax-fehler.de>2017-04-25 11:05:58 +0200
commitbcf11edfd669e8fc4d1a8bcbb86e09242acd591f (patch)
tree861ad2c649b9420d875529716191ed97c52f8950 /krebs/5pkgs/untilport/default.nix
parent9b813fdf07573d2d7099f8d494b7724abe1c0dc7 (diff)
parent8e9337e9ebf875b4738ac20212dc5e7404da2863 (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'krebs/5pkgs/untilport/default.nix')
-rw-r--r--krebs/5pkgs/untilport/default.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/krebs/5pkgs/untilport/default.nix b/krebs/5pkgs/untilport/default.nix
new file mode 100644
index 000000000..61bcc2b89
--- /dev/null
+++ b/krebs/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
+''