summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdebvm-waitssh19
1 files changed, 16 insertions, 3 deletions
diff --git a/debvm-waitssh b/debvm-waitssh
index 4d69657..857a958 100755
--- a/debvm-waitssh
+++ b/debvm-waitssh
@@ -9,7 +9,7 @@ debvm-waitssh - Wait for a ssh server to be reachable
=head1 SYNOPSIS
-B<debvm-waitssh> [B<-t> I<timeout>] [I<hostname>:]I<port>
+B<debvm-waitssh> [B<-q>] [B<-t> I<timeout>] [I<hostname>:]I<port>
=head1 DESCRIPTION
@@ -25,6 +25,10 @@ If no hostname is given, B<127.0.0.1> is assumed.
Set the maximum duration for waiting in seconds.
Defaults to one minute.
+=item B<-q>, B<--quiet>
+
+Be quiet. Output nothing on standard error, not even error messages.
+
=back
=head1 EXIT VALUES
@@ -57,6 +61,7 @@ set -u
TOTALTIMEOUT=60
SCANTIMEOUT=10
SCANDELAY=1
+VERBOSITY=1
nth_arg() {
shift "$1"
@@ -68,7 +73,7 @@ die() {
exit 2
}
usage() {
- die "usage: $0 [-t <timeout>] [<host>:]<port>"
+ die "usage: $0 [-q] [-t <timeout>] [<host>:]<port>"
}
usage_error() {
echo "error: $*" >&2
@@ -79,8 +84,13 @@ opt_timeout() {
TOTALTIMEOUT=$1
}
-while getopts :t:-: OPTCHAR; do
+opt_verbosity() {
+ VERBOSITY=$1
+}
+
+while getopts :qt:-: OPTCHAR; do
case "$OPTCHAR" in
+ q) opt_verbosity 0;;
t) opt_timeout "$OPTARG" ;;
-)
case "$OPTARG" in
@@ -95,6 +105,9 @@ while getopts :t:-: OPTCHAR; do
timeout=)
"opt_${OPTARG%%=*}" "${OPTARG#*=}"
;;
+ quiet)
+ opt_verbosity 0
+ ;;
*)
usage_error "unrecognized option --$OPTARG"
;;