</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>
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.
+ -P Push given files to nodes instead of running commands.
-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.
<NODES> "all", "any", "ok" (or "healthy"), "con" (or "connected"),
"rm" (or "recmaster"), "lvs" (or "lvsmaster"),
"natgw" (or "natgwlist"); or
prefix=""
names_ok=false
push=false
+stdin=false
ctdb_base="${CTDB_BASE:-/etc/ctdb}"
# 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
-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
[ -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