diff options
author | Martin Schwenke <martin@meltin.net> | 2013-11-13 14:04:17 +1100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2013-11-27 18:46:16 +0100 |
commit | 297a4a640dbb48fae50d24c9d7aff397df9b988a (patch) | |
tree | 59c97228cbf2b6c225382a834d9f609116a9a40f /ctdb | |
parent | 3c3e670d83e2f6a514d40db2cc25107b80f0087d (diff) | |
download | samba-297a4a640dbb48fae50d24c9d7aff397df9b988a.tar.gz samba-297a4a640dbb48fae50d24c9d7aff397df9b988a.tar.xz samba-297a4a640dbb48fae50d24c9d7aff397df9b988a.zip |
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>
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/doc/onnode.1.xml | 12 | ||||
-rwxr-xr-x | ctdb/tools/onnode | 15 |
2 files changed, 22 insertions, 5 deletions
diff --git a/ctdb/doc/onnode.1.xml b/ctdb/doc/onnode.1.xml index 561764c1f0e..ec878031633 100644 --- a/ctdb/doc/onnode.1.xml +++ b/ctdb/doc/onnode.1.xml @@ -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> diff --git a/ctdb/tools/onnode b/ctdb/tools/onnode index 0abc13636ef..33d0e20779d 100755 --- a/ctdb/tools/onnode +++ b/ctdb/tools/onnode @@ -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. + -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 @@ -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 |