mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-25 23:47:53 +00:00
parallel: Implemented --ssh.
This commit is contained in:
parent
2549b9ba1a
commit
d4c347c22b
11
src/parallel
11
src/parallel
|
@ -741,6 +741,7 @@ sub options_hash {
|
|||
"sshlogin|S=s" => \@opt::sshlogin,
|
||||
"sshloginfile|slf=s" => \@opt::sshloginfile,
|
||||
"controlmaster|M" => \$opt::controlmaster,
|
||||
"ssh=s" => \$opt::ssh,
|
||||
"return=s" => \@opt::return,
|
||||
"trc=s" => \@opt::trc,
|
||||
"transfer" => \$opt::transfer,
|
||||
|
@ -5387,8 +5388,8 @@ sub sshcommand_of_sshlogin {
|
|||
# login@host
|
||||
my $self = shift;
|
||||
my ($sshcmd, $serverlogin);
|
||||
# If $SSH is unset, use 'ssh'
|
||||
$ENV{'PARALLEL_SSH'} ||= "ssh";
|
||||
# If $opt::ssh is unset, use $PARALLEL_SSH or 'ssh'
|
||||
$opt::ssh ||= $ENV{'PARALLEL_SSH'} || "ssh";
|
||||
if($self->{'string'} =~ /(.+) (\S+)$/) {
|
||||
# Own ssh command
|
||||
$sshcmd = $1; $serverlogin = $2;
|
||||
|
@ -5397,7 +5398,7 @@ sub sshcommand_of_sshlogin {
|
|||
if($opt::controlmaster) {
|
||||
# Use control_path to make ssh faster
|
||||
my $control_path = $self->control_path_dir()."/ssh-%r@%h:%p";
|
||||
$sshcmd = $ENV{'PARALLEL_SSH'}." -S ".$control_path;
|
||||
$sshcmd = $opt::ssh." -S ".$control_path;
|
||||
$serverlogin = $self->{'string'};
|
||||
if(not $self->{'control_path'}{$control_path}++) {
|
||||
# Master is not running for this control_path
|
||||
|
@ -5419,14 +5420,14 @@ sub sshcommand_of_sshlogin {
|
|||
# if the ssh connection closes.
|
||||
my $sleep = ::shell_quote_scalar
|
||||
('$|=1;while(1){sleep 1;print "foo\n"}');
|
||||
my @master = ($ENV{'PARALLEL_SSH'}, "-tt", "-MTS",
|
||||
my @master = ($opt::ssh, "-tt", "-MTS",
|
||||
$control_path, $serverlogin, "perl", "-e",
|
||||
$sleep);
|
||||
exec(@master);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$sshcmd = $ENV{'PARALLEL_SSH'}; $serverlogin = $self->{'string'};
|
||||
$sshcmd = $opt::ssh; $serverlogin = $self->{'string'};
|
||||
}
|
||||
}
|
||||
$self->{'sshcommand'} = $sshcmd;
|
||||
|
|
|
@ -1679,6 +1679,13 @@ Do not use the first line of input (used by GNU B<parallel> itself
|
|||
when called with B<--shebang>).
|
||||
|
||||
|
||||
=item B<--ssh> I<sshcommand> (alpha testing)
|
||||
|
||||
GNU B<parallel> defaults to using B<ssh> for remote access. This can
|
||||
be overridden with B<--ssh>. It can also be set on a per server
|
||||
basis (see B<--sshlogin>).
|
||||
|
||||
|
||||
=item B<--sshdelay> I<secs>
|
||||
|
||||
Delay starting next ssh by I<secs> seconds. GNU B<parallel> will pause
|
||||
|
@ -3442,8 +3449,9 @@ $SHELL. If undefined use:
|
|||
=item $PARALLEL_SSH (alpha testing)
|
||||
|
||||
GNU B<parallel> defaults to using B<ssh> for remote access. This can
|
||||
be overridden with $PARALLEL_SSH. It can also be set on a per server
|
||||
basis (see B<--sshlogin>).
|
||||
be overridden with $PARALLEL_SSH, which again can be overridden with
|
||||
B<--ssh>. It can also be set on a per server basis (see
|
||||
B<--sshlogin>).
|
||||
|
||||
|
||||
=item $PARALLEL_SEQ
|
||||
|
|
|
@ -66,6 +66,11 @@ echo '### use function as $PARALLEL_SSH'
|
|||
export -f foossh;
|
||||
PARALLEL_SSH=foossh parallel -S 1/lo echo ::: 'Run through FOOSSH?'
|
||||
|
||||
echo '### use --ssh'
|
||||
barssh() { echo "BARSSH" >&2; ssh "$@"; };
|
||||
export -f barssh;
|
||||
parallel --ssh barssh -S 1/lo echo ::: 'Run through BARSSH?'
|
||||
|
||||
echo '### test filename :'
|
||||
echo content-of-: > :;
|
||||
echo : | parallel -j1 --trc {}.{.} -S parallel@lo '(echo remote-{}.{.};cat {}) > {}.{.}';
|
||||
|
|
|
@ -89,6 +89,11 @@ echo '### use function as $PARALLEL_SSH'
|
|||
foossh() { echo "FOOSSH" >&2; ssh "$@"; }; export -f foossh; PARALLEL_SSH=foossh parallel -S 1/lo echo ::: 'Run through FOOSSH?'
|
||||
Run through FOOSSH?
|
||||
FOOSSH
|
||||
echo '### use --ssh'
|
||||
### use --ssh
|
||||
barssh() { echo "BARSSH" >&2; ssh "$@"; }; export -f barssh; parallel --ssh barssh -S 1/lo echo ::: 'Run through BARSSH?'
|
||||
Run through BARSSH?
|
||||
BARSSH
|
||||
echo '### test filename :'
|
||||
### test filename :
|
||||
echo content-of-: > :; echo : | parallel -j1 --trc {}.{.} -S parallel@lo '(echo remote-{}.{.};cat {}) > {}.{.}'; cat :.:; rm : :.:
|
||||
|
|
Loading…
Reference in a new issue