RSS: articles / comments



Onall: Usage

Onall is a tool to help admin large numbers of systems. Onall allows hostnames to be piped into to STDIN, and commands to be run, via ssh, on all piped systems, in parallel. Command line options allow configuring the number of sequential hosts, the timeout, and time between batches.

Command Line Options

onall [<options>] --script <script> <script_args>
onall [<options>] --copy <file> <dest_path> -c, --copy <file> [<dest_path>]


                Copy <file> to destination as <dest_path>. If not specified,
                <dest_path> will be same as <file>.

-d, --delay

                Delay N seconds between the fork of each ssh
                child process.  Default is 0.

-h, --help

Extended help (this screen).

-l, --linenums

Append line numbers to command generated output.

-o, --logpath

                Output results to files named by the hostname
                named by dir/hostname.

-p, --ping

                Fping all hosts prior to attempting an
                ssh connection.

-q, --quiet

                Semi-quiet mode.  Supresses sanity check
                information and assumes YES to all prompts.

-r, --rate

                Run command on N machines in parallel.  This is
                the number of ssh connections open at a given time.
                Default is 20.

-e, --script <script> [<script_args>]

                Transfer/execute a script from the local system
                to each target system.  In this mode the <command>
                should be a path to a local script.  Any arguments
                which follow will be passed to the remote script.

-A, --ssh_arguments

pass arguments directly to ssh

-Q, --ssh_quiet

run ssh in quiet mode

-s, --suppress

                Supress hostnames and line numbers from being
                prepended to result data.

-f, --syslist

                Path to system list file.  If unspecified, the
                list will be read from STDIN.  Expected input
                format is hostname/IP, followed by newline.

-t, --timeout

                Timeout in seconds before child ssh processes
                are killed.  Be careful with this arguement, as
                all running/pending commands on the machine in
                question will be terminated potentially leaving
                the system in an unknown state.  Default is 300.

-b, --unbuffered

                Turn OFF output buffering of result data.  By
                default, onall will display all output after
                remote command execution is complete, thereby
                maintaining proper order.  When buffering is
                off, result data will be returned as each
                line is received.

-u, --user

                Specifies the username ssh will use to log in
                to remote systems.  Default is root.

-y, --yes

Assume YES for all prompts.

Examples

onall -f cluster1.list -r50 -t30 'grep fls1 /etc/fstab | wc -l' cat cluster1web.list | onall -r20 '/etc/init.d/httpd-* stop'

<tool that generates list of hosts based on options> | onall -r 12 -t30 'df; vmstat'

<tool that generates list of hosts based on options> | onall -e ~user/scripts/do_stuff --now

<tool that generates list of hosts based on options> | onall -c ~bin/coolutil /usr/bin/coolutil

Notes

Command syntax is expected to be written in bash. Syntax will be verified prior to forking any ssh children. It is usually best to enclose the command in 'single quotes', or insert shell escapes where nessessary. SSH keys must be loaded via ssh-agent/ssh-add prior to running onall.


News


Recent Commits