mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
ctdb-onnode: New -i option to stop stdin from being closed
This can be useful for piping data to onnode in certain circumstances. There are now also enough command-line options that they should definitely be alphabetically ordered. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
This commit is contained in:
parent
3c3e670d83
commit
297a4a640d
@ -68,6 +68,18 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term>-i</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Keep standard input open, allowing data to be piped to
|
||||
onnode. Normally onnode closes stdin to avoid surprises
|
||||
when scripting. Note that this option is ignored when
|
||||
using <option>-p</option> or if <envar>SSH</envar> is set
|
||||
to anything other than "ssh".
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term>-n</term>
|
||||
<listitem>
|
||||
<para>
|
||||
|
@ -31,13 +31,14 @@ usage ()
|
||||
Usage: onnode [OPTION] ... <NODES> <COMMAND> ...
|
||||
options:
|
||||
-c Run in current working directory on specified nodes.
|
||||
-f Specify nodes file, overrides CTDB_NODES_FILE.
|
||||
-i Keep standard input open - the default is to close it.
|
||||
-n Allow nodes to be specified by name.
|
||||
-o <prefix> Save standard output from each node to file <prefix>.<ip>
|
||||
-p Run command in parallel on specified nodes.
|
||||
-q Do not print node addresses (overrides -v).
|
||||
-n Allow nodes to be specified by name.
|
||||
-f Specify nodes file, overrides CTDB_NODES_FILE.
|
||||
-v Print node address even for a single node.
|
||||
-P Push given files to nodes instead of running commands.
|
||||
-q Do not print node addresses (overrides -v).
|
||||
-v Print node address even for a single node.
|
||||
<NODES> "all", "any", "ok" (or "healthy"), "con" (or "connected"),
|
||||
"rm" (or "recmaster"), "lvs" (or "lvsmaster"),
|
||||
"natgw" (or "natgwlist"); or
|
||||
@ -64,6 +65,7 @@ quiet=false
|
||||
prefix=""
|
||||
names_ok=false
|
||||
push=false
|
||||
stdin=false
|
||||
|
||||
ctdb_base="${CTDB_BASE:-/etc/ctdb}"
|
||||
|
||||
@ -74,7 +76,7 @@ parse_options ()
|
||||
# options ot onnode.
|
||||
local temp
|
||||
# Not on the previous line - local returns 0!
|
||||
temp=$(POSIXLY_CORRECT=1 getopt -n "$prog" -o "cf:hno:pqvP" -l help -- "$@")
|
||||
temp=$(POSIXLY_CORRECT=1 getopt -n "$prog" -o "cf:hno:pqvPi" -l help -- "$@")
|
||||
|
||||
[ $? != 0 ] && usage
|
||||
|
||||
@ -90,6 +92,7 @@ parse_options ()
|
||||
-q) quiet=true ; shift ;;
|
||||
-v) verbose=true ; shift ;;
|
||||
-P) push=true ; shift ;;
|
||||
-i) stdin=true ; shift ;;
|
||||
--) shift ; break ;;
|
||||
-h|--help|*) usage ;; # Shouldn't happen, so this is reasonable.
|
||||
esac
|
||||
@ -367,7 +370,9 @@ else
|
||||
[ -r "${ctdb_base}/onnode.conf" ] && . "${ctdb_base}/onnode.conf"
|
||||
[ -n "$SSH" ] || SSH=ssh
|
||||
if [ "$SSH" = "ssh" ] ; then
|
||||
ssh_opts="-n"
|
||||
if $parallel || ! $stdin ; then
|
||||
ssh_opts="-n"
|
||||
fi
|
||||
else
|
||||
: # rsh? All bets are off!
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user