App-RemoteCommand

 view release on metacpan or  search on metacpan

lib/App/RemoteCommand/Tutorial.pod  view on Meta::CPAN

=encoding utf-8

=for stopwords misc

=head1 NAME

App::RemoteCommand::Tutorial - tutorial!

=head1 TUTORIAL

App::RemoteCommand or its frontend C<< rcommand >>
is a simple remote command launcher via ssh.
You can use it like C< ssh > command.

Let's say you have 6 hosts:

    www001.example.com, www002.example.com, www003.examle.com,
    www001.example.jp,  www002.example.jp,  www003.examle.jp

and you can ssh these hosts without password or passphrase.
If your ssh private key needs a passphrase, please setup C<ssh-agent> first.

=over 4

=item 1. simple

The usual form is (much like C<ssh> command):

    > rcommand HOSTS COMMANDS

For example, to execute C<uname> command in C<www001.example.com>:

    > rcommand www001.example.com uname
    [www001.example.com] Linux
    SUCCESS www001.example.com

Add C<www002.example.com> too:

    > rcommand 'www001.example.com,www002.example.com' uname
    [www001.example.com] Linux
    [www002.example.com] Linux
    SUCCESS www001.example.com
    SUCCESS www002.example.com

Oh, you can use range notation C<< [*-*] >> instead of using just separator C<< , >>:

    > rcommand 'www[001-003].example.com' uname
    [www001.example.com] Linux
    [www002.example.com] Linux
    [www003.example.com] Linux
    SUCCESS www001.example.com
    SUCCESS www002.example.com
    SUCCESS www003.example.com

and choice notation C<< {*,*} >>:

    > rcommand 'www001.example.{com,jp}' uname
    [www001.example.com] Linux
    [www001.example.jp] Linux
    SUCCESS www001.example.com
    SUCCESS www001.example.jp

of course both at the same time:

    > rcommand 'www00[1-2].example.{com,jp}' uname
    [www001.example.com] Linux
    [www002.example.com] Linux
    [www001.example.jp] Linux
    [www002.example.jp] Linux
    SUCCESS www001.example.com
    SUCCESS www002.example.com
    SUCCESS www001.example.jp
    SUCCESS www002.example.jp

=item 2. execute local script



( run in 1.062 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )