mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-12-23 13:17:54 +00:00
src/parallel: --load on remote machines fixed. --nice uses \nice for tcsh and remote machines with differerent path to nice.
This commit is contained in:
parent
635e5081d6
commit
12897fe3c2
31
src/parallel
31
src/parallel
|
@ -2506,13 +2506,11 @@ sub loadavg {
|
||||||
$self->{'last_loadavg_update'} = time;
|
$self->{'last_loadavg_update'} = time;
|
||||||
-e $ENV{'HOME'}."/.parallel" or mkdir $ENV{'HOME'}."/.parallel";
|
-e $ENV{'HOME'}."/.parallel" or mkdir $ENV{'HOME'}."/.parallel";
|
||||||
-e $ENV{'HOME'}."/.parallel/tmp" or mkdir $ENV{'HOME'}."/.parallel/tmp";
|
-e $ENV{'HOME'}."/.parallel/tmp" or mkdir $ENV{'HOME'}."/.parallel/tmp";
|
||||||
my $cmd;
|
my $cmd = "";
|
||||||
if($self->{'string'} eq ":") {
|
if($self->{'string'} ne ":") {
|
||||||
$cmd = "ps ax -o state,command";
|
$cmd = $self->sshcommand() . " " . $self->serverlogin() . " ";
|
||||||
} else {
|
|
||||||
$cmd = $self->sshcommand() . " " . $self->serverlogin() .
|
|
||||||
"ps ax -o state,command";
|
|
||||||
}
|
}
|
||||||
|
$cmd .= "ps ax -o state,command";
|
||||||
# As the command can take long to run if run remote
|
# As the command can take long to run if run remote
|
||||||
# save it to a tmp file before moving it to the correct file
|
# save it to a tmp file before moving it to the correct file
|
||||||
my $file = $self->{'loadavg_file'};
|
my $file = $self->{'loadavg_file'};
|
||||||
|
@ -4582,9 +4580,10 @@ sub replaced {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($opt::nice) {
|
if($opt::nice) {
|
||||||
# Prepend nice -n19 $SHELL -c
|
# Prepend \nice -n19 $SHELL -c
|
||||||
# and quote
|
# and quote
|
||||||
$self->{'replaced'} = nice() ." -n" . $opt::nice . " "
|
# \ before nice is needed to avoid tcsh's built-in
|
||||||
|
$self->{'replaced'} = '\nice' ." -n" . $opt::nice . " "
|
||||||
. $ENV{SHELL}." -c "
|
. $ENV{SHELL}." -c "
|
||||||
. ::shell_quote_scalar($self->{'replaced'});
|
. ::shell_quote_scalar($self->{'replaced'});
|
||||||
}
|
}
|
||||||
|
@ -4603,22 +4602,6 @@ sub replaced {
|
||||||
return $self->{'replaced'};
|
return $self->{'replaced'};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub nice {
|
|
||||||
# Returns:
|
|
||||||
# path to nice
|
|
||||||
# Needed because tcsh's built-in nice does not support 'nice -n19'
|
|
||||||
if(not $Global::path_to_nice) {
|
|
||||||
$Global::path_to_nice = "nice";
|
|
||||||
for my $n ((split/:/, $ENV{'PATH'}), "/bin", "/usr/bin") {
|
|
||||||
if(-x $n."/nice") {
|
|
||||||
$Global::path_to_nice = $n."/nice";
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $Global::path_to_nice;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub replace_placeholders {
|
sub replace_placeholders {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $target = shift;
|
my $target = shift;
|
||||||
|
|
Loading…
Reference in a new issue