App-nrun
view release on metacpan or search on metacpan
nrun
====
nrun will run a single command or script on a multiple of target servers
synchronously. ncopy will copy a file or directory to multiple target servers.
the underlying remote access mechanism is exchangeable. as of now, ssh, nsh, rsh
and local execution modes are implemented.
the return code and all command output will be logged.
Copyright 2013 Timo Benk <benk@b1-systems.de>
nrun is free software: you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation,
--target,-t HOST1,HOST2 comma separated list of target hosts.
--timeout SEC timeout for each command execution (defaults to 60).
--version,-v print the version string and exit.
--mode,-m MODE remote execution mode:
generic - generic mode
local - execute the script locally, set TARGET_HOST on each execution
nsh - nsh based remote execution
rsh - rsh based remote execution
* ssh - ssh based remote execution
--filter,-f FILTER output filter to be applied:
async - dump the command output asynchroniously
null - do nothing
raw - dump the raw data received from the worker module
result - dump only the exit code
* sync - dump the command output synchroniously
--logger,-l LOGGER1,LOGGER2 logger to be used:
null - do nothing
* output - log the command output
* raw - log the raw data received from the worker module
* result - log only the exit code
--check,-c CHECK1,CHECK2 checks to be applied to each host:
* ns - check if hostname is resolvable
null - do nothing
* ping - check if host answers to ping
rscd - check if rscd agent answers
--target,-t HOST1,HOST2 comma separated list of target hosts.
--timeout SEC timeout for each command execution (defaults to 60).
--version,-v print the version string and exit.
--mode,-m MODE remote execution mode:
generic - generic mode
local - execute the script locally, set TARGET_HOST on each execution
nsh - nsh based remote execution
rsh - rsh based remote execution
* ssh - ssh based remote execution
--filter,-f FILTER output filter to be applied:
async - dump the command output asynchroniously
null - do nothing
raw - dump the raw data received from the worker module
* result - dump only the exit code
sync - dump the command output synchroniously
--logger,-l LOGGER1,LOGGER2 logger to be used:
null - do nothing
* output - log the command output
* raw - log the raw data received from the worker module
* result - log only the exit code
--check,-c CHECK1,CHECK2 checks to be applied to each host:
* ns - check if hostname is resolvable
null - do nothing
* ping - check if host answers to ping
rscd - check if rscd agent answers
this filter will just dump the output as it is provided by the worker process. no
formatting will be done.
format:
HOSTNAME;[stdout|stderr];TSTAMP;PID;PID(CHILD);[debug|error|exit|output|end];"OUTPUT"
filter async
============
this filter dumps the worker process output unsynchronized in the following format. unsynchronised
means, that output lines from the different worker processes are printed at the same time they are
generated.
format:
HOSTNAME: OUTPUT
filter sync
============
this filter dumps the worker process output synchronised in the following format. synchronized
means, that the complete output for a single hosts will be dumped at once when the worker proces
has finished execution.
format:
HOSTNAME: OUTPUT
filter result
=============
ncopy - copy a file or directory to multiple target servers.
=head1 SYNOPSIS
ncopy -t HOST1[,HOST2,...] [--log-directory]
[-p MAX] [--timeout SEC] [-v] [-m MODE] [-f FILTER] [-l LOGGER1[,LOGGER2...]]
[-c CHECK1[,CHECK2]] -- SOURCE TARGET
=head1 DESCRIPTION
ncopy will copy a file or directory to multiple target servers synchronously.
the underlying remote access mechanism is exchangeable. as of now, ssh, nsh, rsh
and local execution modes are implemented.
=head1 OPTIONS
B<--check,-c CHECK1[,CHECK2]> checks to be applied to each host (see CHECKS)
B<--filter,-f FILTER1> output filter to be applied (see FILTER).
this filter will just dump the output as it is provided by the worker process. no
formatting will be done.
format:
HOSTNAME;[stdout|stderr];TSTAMP;PID;PID(CHILD);[debug|error|exit|output|end];"OUTPUT"
=head2 filter async
this filter dumps the worker process output unsynchronized in the following format. unsynchronised
means, that output lines from the different worker processes are printed at the same time they are
generated.
format:
HOSTNAME: OUTPUT
=head2 filter sync
this filter dumps the worker process output synchronised in the following format. synchronized
means, that the complete output for a single hosts will be dumped at once when the worker proces
has finished execution.
format:
HOSTNAME: OUTPUT
=head2 filter result
this filter will only print the exit codes for the worker processes.
main();
__END__
=pod
=head1 NAME
nrun - run a single command or script on a multiple of target servers
synchronously.
=head1 SYNOPSIS
nrun -t HOST1[,HOST2,...] [--copy] [--log-directory]
[-p MAX] [--timeout SEC] [-v] [-m MODE] [-f FILTER] [-l LOGGER1[,LOGGER2...]]
[-c CHECK1[,CHECK2]] -- COMMAND
=head1 DESCRIPTION
nrun will run a single command or script on a multiple of target servers
synchronously.
the underlying remote access mechanism is exchangeable. as of now, ssh, nsh, rsh
and local execution modes are implemented.
=head1 OPTIONS
B<--check,-c CHECK1[,CHECK2]> checks to be applied to each host (see CHECKS)
B<--copy,-c> copy command to target host before execution.
this filter will just dump the output as it is provided by the worker process. no
formatting will be done.
format:
HOSTNAME;[stdout|stderr];TSTAMP;PID;PID(CHILD);[debug|error|exit|output|end];"OUTPUT"
=head2 filter async
this filter dumps the worker process output unsynchronized in the following format. unsynchronised
means, that output lines from the different worker processes are printed at the same time they are
generated.
format:
HOSTNAME: OUTPUT
=head2 filter sync
this filter dumps the worker process output synchronised in the following format. synchronized
means, that the complete output for a single hosts will be dumped at once when the worker proces
has finished execution.
format:
HOSTNAME: OUTPUT
=head2 filter result
this filter will only print the exit codes for the worker processes.
lib/NRun/Filters/FilterAsync.pm view on Meta::CPAN
# Branch: master
#
# Changelog:--reverse --grep '^tags.*relevant':-1:%an : %ai : %s
#
# Timo Benk : 2013-06-13 13:59:01 +0200 : process output handling refined
# Timo Benk : 2013-06-13 20:32:17 +0200 : using __PACKAGE__ is less error-prone
# Timo Benk : 2013-06-14 17:38:58 +0200 : --no-hostname option removed
#
###
# this filter provides asynchronious command output.
###
package NRun::Filters::FilterAsync;
use strict;
use warnings;
use File::Basename;
use NRun::Filter;
our @ISA = qw(NRun::Filter);
BEGIN {
NRun::Filter::register ( {
'FILTER' => "async",
'DESC' => "dump the command output asynchroniously",
'NAME' => __PACKAGE__,
} );
}
###
# create a new object.
#
# <- the new object
sub new {
lib/NRun/Filters/FilterSync.pm view on Meta::CPAN
# Branch: master
#
# Changelog:--reverse --grep '^tags.*relevant':-1:%an : %ai : %s
#
# Timo Benk : 2013-06-13 13:59:01 +0200 : process output handling refined
# Timo Benk : 2013-06-13 20:32:17 +0200 : using __PACKAGE__ is less error-prone
# Timo Benk : 2013-06-14 17:38:58 +0200 : --no-hostname option removed
#
###
# this filter provides synchronious command output.
###
package NRun::Filters::FilterSync;
use strict;
use warnings;
use File::Basename;
use NRun::Filter;
our @ISA = qw(NRun::Filter);
BEGIN {
NRun::Filter::register ( {
'FILTER' => "sync",
'DESC' => "dump the command output synchroniously",
'NAME' => __PACKAGE__,
} );
}
###
# create a new object.
#
# <- the new object
sub new {
( run in 0.427 second using v1.01-cache-2.11-cpan-0d8aa00de5b )