mirror of
https://github.com/duncs/clusterssh.git
synced 2025-07-03 18:03:23 +00:00
Add in 'ccon' command
Thanks for Brandon Perkins for the patch
This commit is contained in:
parent
e58a20de24
commit
f04b4040ae
10 changed files with 65 additions and 10 deletions
|
@ -79,6 +79,7 @@ my @options_spec = (
|
|||
'tile|g',
|
||||
'no-tile|G',
|
||||
'username|l=s',
|
||||
'master|M=s',
|
||||
'options|o=s',
|
||||
'port|p=i',
|
||||
'autoquit|q',
|
||||
|
@ -227,6 +228,8 @@ sub load_config_defaults() {
|
|||
|
||||
$config{comms} = "telnet" if ( $config{comms} eq "tel" );
|
||||
|
||||
$config{comms} = "console" if ( $config{comms} eq "con" );
|
||||
|
||||
$config{ $config{comms} } = $config{comms};
|
||||
|
||||
$config{ssh_args} = " -x -o ConnectTimeout=10"
|
||||
|
@ -235,6 +238,8 @@ sub load_config_defaults() {
|
|||
|
||||
$config{telnet_args} = "";
|
||||
|
||||
$config{console_args} = "";
|
||||
|
||||
$config{extra_cluster_file} = "";
|
||||
|
||||
$config{unmap_on_redraw} = "no"; # Debian #329440
|
||||
|
@ -349,8 +354,8 @@ sub check_config() {
|
|||
|
||||
# make sure comms in an accepted value
|
||||
die
|
||||
"FATAL: Only ssh, rsh and telnet protocols are currently supported (comms=$config{comms})\n"
|
||||
if ( $config{comms} !~ /^(:?[rs]sh|telnet)$/ );
|
||||
"FATAL: Only ssh, rsh, telnet, and console/conserver protocols are currently supported (comms=$config{comms})\n"
|
||||
if ( $config{comms} !~ /^(:?[rs]sh|telnet|console)$/ );
|
||||
|
||||
# Set any extra config options given on command line
|
||||
$config{title} = $options{title} if ( $options{title} );
|
||||
|
@ -374,6 +379,9 @@ sub check_config() {
|
|||
$config{window_tiling} = "no" if $options{'no-tile'};
|
||||
|
||||
$config{user} = $options{username} if ( $options{username} );
|
||||
|
||||
$config{mstr} = $options{master} if ( $options{master} );
|
||||
|
||||
$config{terminal_args} = $options{'term-args'}
|
||||
if ( $options{'term-args'} );
|
||||
|
||||
|
@ -926,6 +934,7 @@ sub setup_helper_script() {
|
|||
my \$svr=shift;
|
||||
my \$user=shift;
|
||||
my \$port=shift;
|
||||
my \$mstr=shift;
|
||||
my \$command="$config{$config{comms}} $config{$config{comms}."_args"} ";
|
||||
open(PIPE, ">", \$pipe) or die("Failed to open pipe: \$!\\n");
|
||||
print PIPE "\$\$:\$ENV{WINDOWID}"
|
||||
|
@ -938,6 +947,12 @@ sub setup_helper_script() {
|
|||
);
|
||||
sleep 5;
|
||||
}
|
||||
if(\$mstr) {
|
||||
unless("$config{comms}" ne "console") {
|
||||
\$mstr = \$mstr ? "-M \$mstr " : "";
|
||||
\$command .= \$mstr;
|
||||
}
|
||||
}
|
||||
if(\$user) {
|
||||
unless("$config{comms}" eq "telnet") {
|
||||
\$user = \$user ? "-l \$user " : "";
|
||||
|
@ -1040,6 +1055,7 @@ sub open_client_windows(@) {
|
|||
my $username = $server_object->get_username();
|
||||
my $port = $server_object->get_port();
|
||||
my $server = $server_object->get_hostname();
|
||||
my $master = $server_object->get_master();
|
||||
|
||||
#my ( $username, $server, $port ) = split_hostname($_);
|
||||
my $given_server_name = $server_object->get_givenname();
|
||||
|
@ -1083,6 +1099,8 @@ sub open_client_windows(@) {
|
|||
$servers{$server}{username} = $username if ($username);
|
||||
$servers{$server}{username} = $username || '';
|
||||
$servers{$server}{port} = $port || '';
|
||||
$servers{$server}{master} = $config{mstr};
|
||||
$servers{$server}{master} = $master if ($master);
|
||||
|
||||
logmsg( 2, "Working on server $server for $_" );
|
||||
|
||||
|
@ -1106,7 +1124,7 @@ sub open_client_windows(@) {
|
|||
# affecting the main program
|
||||
$servers{$server}{realname} .= "==" if ( !$realname );
|
||||
my $exec
|
||||
= "$config{terminal} $color $config{terminal_args} $config{terminal_allow_send_events} $config{terminal_title_opt} '$config{title}: $servers{$server}{connect_string}' -font $config{terminal_font} -e \"$^X\" \"-e\" '$helper_script' '$servers{$server}{pipenm}' '$servers{$server}{givenname}' '$servers{$server}{username}' '$servers{$server}{port}'";
|
||||
= "$config{terminal} $color $config{terminal_args} $config{terminal_allow_send_events} $config{terminal_title_opt} '$config{title}: $servers{$server}{connect_string}' -font $config{terminal_font} -e \"$^X\" \"-e\" '$helper_script' '$servers{$server}{pipenm}' '$servers{$server}{givenname}' '$servers{$server}{username}' '$servers{$server}{port}' '$servers{$server}{master}'";
|
||||
logmsg( 2, "Terminal exec line:\n$exec\n" );
|
||||
exec($exec) == 0 or warn("Failed: $!");
|
||||
}
|
||||
|
@ -2263,7 +2281,7 @@ App::ClusterSSH - A container for functions of the ClusterSSH programs
|
|||
=head1 SYNOPSIS
|
||||
|
||||
There is nothing in this module for public consumption. See documentation
|
||||
for F<cssh>, F<crsh>, F<ctelnet>, or F<cscp> instead.
|
||||
for F<cssh>, F<crsh>, F<ctel>, F<ccon>, or F<cscp> instead.
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
|
|
|
@ -83,6 +83,17 @@ sub set_port {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub get_master {
|
||||
my ($self) = @_;
|
||||
return $self->{master} || q{};
|
||||
}
|
||||
|
||||
sub set_master {
|
||||
my ( $self, $new_master ) = @_;
|
||||
$self->{master} = $new_master;
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub get_realname {
|
||||
my ($self) = @_;
|
||||
|
||||
|
@ -277,12 +288,16 @@ Create a new host object. 'hostname' is a required arg, 'username' and
|
|||
|
||||
=item $host->get_port
|
||||
|
||||
=item $host->get_master
|
||||
|
||||
Return specific details about the host
|
||||
|
||||
=item $host->set_username
|
||||
|
||||
=item $host->set_port
|
||||
|
||||
=item $host->set_master
|
||||
|
||||
Set specific details about the host after its been created.
|
||||
|
||||
=item get_realname
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue