diff --git a/xCAT-client/bin/rcons b/xCAT-client/bin/rcons index 78bd8e901..09c0522c8 100755 --- a/xCAT-client/bin/rcons +++ b/xCAT-client/bin/rcons @@ -52,7 +52,27 @@ if [ -n "$2" ]; then fi fi -if [ -f "/usr/bin/console" ] || [ -f "/bin/console" ]; then +if [ -x "/opt/confluent/bin/confetty" ] || [ -x "/usr/bin/confetty" ]; then + #use confluent + CONFETTY="confetty" + if [ -x "/opt/confluent/bin/confetty" ]; then + CONFETTY="/opt/confluent/bin/confetty" + fi + if [ ! -z "$CONSCONTROLPATH" ]; then + CONSCONTROLPATH="-c $CONSCONTROLPATH" + fi + if [ -z "$CONSERVER" ]; then + CONSERVER=`nodels $1 nodehm.conserver 2>/dev/null | awk -F: '{print $2}' | tr -d ' '` + fi + + if [ -z "$CONSERVER" ]; then + CONSERVER=$XCATHOST + fi + if [ ! -z "$CONSERVER" ]; then + CONSERVER="-s $CONSERVER" + fi + $CONFETTY $CONSCONTROLPATH $CONSERVER $1 +elif [ -f "/usr/bin/console" ] || [ -f "/bin/console" ]; then #use conserver if [ -z "$CONSERVER" ]; then CONSERVER=`nodels $1 nodehm.conserver 2>/dev/null | awk -F: '{print $2}' | tr -d ' '` diff --git a/xCAT-client/bin/wcons b/xCAT-client/bin/wcons index 13a95dcb0..abb1df1d9 100755 --- a/xCAT-client/bin/wcons +++ b/xCAT-client/bin/wcons @@ -3,6 +3,8 @@ use Getopt::Long qw(:config getopt_compat pass_through); use File::Basename; BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; } +use IO::Socket::UNIX; +use Time::HiRes qw/sleep/; use lib "$::XCATROOT/lib/perl"; use xCAT::Client; #use Data::Dumper; @@ -54,7 +56,6 @@ foreach (@nodes) { $conservers{$_} =~ s/:.*//; next; } - $conservers{$_} = 'localhost'; } @@ -82,7 +83,7 @@ if (defined($tilefact)) { $screenheight=$1; } } - $rootinf = `xwininfo -name "Top Panel"`; + $rootinf = `xwininfo -name "Top Panel" 2> /dev/null`; foreach (split /\n/,$rootinf) { if (/-geometry\s+([0-9]+)x([0-9]+)\+([0-9]+)\+([0-9]+)/) { if ($1 > 640 and $2 < 480 and $3 == 0 and $4 == 0) { @@ -91,7 +92,7 @@ if (defined($tilefact)) { } } if ($panel_pad == 0) { - $rootinf = `xwininfo -name "Top Expanded Edge Panel"`; + $rootinf = `xwininfo -name "Top Expanded Edge Panel" 2> /dev/null`; foreach (split /\n/,$rootinf) { if (/-geometry\s+([0-9]+)x([0-9]+)\+([0-9]+)\+([0-9]+)/) { if ($1 > 640 and $2 < 480 and $3 == 0 and $4 == 0) { @@ -102,9 +103,24 @@ if (defined($tilefact)) { } + $ENV{CONSCONTROLPATH} = "/tmp/wconscontrol.$firstnode.$$"; system("xterm $xrm -bg black -fg white -title $firstnode -n $firstnode -geometry +0+0 ".join(" ",@ARGV)." -e /bin/bash -c \"$mydir/xtcd.pl ".$ENV{DISPLAY}." $firstnode $firstnode & let SDATE=`date +%s`+5; $mydir/rcons $firstnode ".$conservers{$firstnode}."; if [ \\\$SDATE -gt \\`date +%s\\` ]; then echo Press enter to close; read SDATE; fi \" &"); - sleep(2); #Give time for window manager to figure out everything - my $xinfo = `xwininfo -name $firstnode`; + my $remainwait = 2; + while (not -S "/tmp/wconscontrol.$firstnode.$$" and $remainwait > 0) { + sleep(0.1); + $remainwait -= 0.1; + } + my $xinfo; + if (-S "/tmp/wconscontrol.$firstnode.$$") { # confluent mode + my $controlchannel = IO::Socket::UNIX->new(Type=>SOCK_STREAM(), Peer => "/tmp/wconscontrol.$firstnode.$$"); + print $controlchannel "GETWINID\n"; + my $winid = <$controlchannel>; + $winid = <$controlchannel>; + $xinfo = `xwininfo -id $winid`; + } else { + $xinfo = `xwininfo -name $firstnode`; + } + my @xinfl = split(/\n/,$xinfo); my $side_pad; my $wmxo;