l: add untilport

This commit is contained in:
lassulus 2016-05-20 00:12:43 +02:00
parent 0fd95b3228
commit 3fea8d651f
3 changed files with 20 additions and 0 deletions

View File

@ -112,6 +112,7 @@ with config.krebs.lib;
#neat utils
krebspaste
psmisc
untilport
#unpack stuff
p7zip

View File

@ -10,6 +10,7 @@
};
mk_sql_pair = pkgs.callPackage ./mk_sql_pair/default.nix {};
mpv-poll = pkgs.callPackage ./mpv-poll/default.nix {};
untilport = pkgs.callPackage ./untilport/default.nix {};
urban = pkgs.callPackage ./urban/default.nix {};
xmonad-lass =
let src = pkgs.writeNixFromCabal "xmonad-lass.nix" ./xmonad-lass; in

View File

@ -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
''