e68fe9d2db
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1561 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
49 lines
1.7 KiB
Perl
Executable File
49 lines
1.7 KiB
Perl
Executable File
#!/usr/bin/env perl
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
BEGIN
|
|
{
|
|
use Time::HiRes qw(sleep);
|
|
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
|
my $sleepint=int(rand(10));
|
|
print "Opening console in ".(2+(0.5*$sleepint))." seconds...\n";
|
|
sleep $sleepint;
|
|
}
|
|
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
|
use lib "$::XCATROOT/lib/perl";
|
|
require xCAT::Table;
|
|
require xCAT::Utils;
|
|
my $dba;
|
|
my $ipmitab = xCAT::Table->new('ipmi');
|
|
unless ($ipmitab) { die "Unable to open IPMI table"; }
|
|
my $passtab = xCAT::Table->new('passwd');
|
|
my $username = 'USERID';
|
|
my $password = 'PASSW0RD';
|
|
my $node = $ARGV[0];
|
|
my $bmc = $node;
|
|
if ($passtab) {
|
|
($dba) = $passtab->getAttribs({key=>'ipmi'},qw(username password));
|
|
if ($dba) {
|
|
if ($dba->{username}) { $username = $dba->{username}; }
|
|
if ($dba->{password}) { $password = $dba->{password}; }
|
|
}
|
|
}
|
|
|
|
$dba = $ipmitab->getNodeAttribs($ARGV[0],[qw(bmc username password)]);
|
|
if ($dba) {
|
|
if ($dba->{bmc}) { $bmc = $dba->{bmc}; }
|
|
if ($dba->{username}) { $username = $dba->{username}; }
|
|
if ($dba->{password}) { $password = $dba->{password}; }
|
|
}
|
|
xCAT::Utils::close_all_dbhs;
|
|
#my $isintel = system "ipmitool -I lanplus -U $username -P $password -H $bmc chassis status > /dev/null 2>&1";
|
|
my $isintel = system "ipmitool -I lan -U $username -P $password -H $bmc mc info| grep 'Manufacturer ID : 343' > /dev/null 2>&1";
|
|
$isintel = not $isintel;
|
|
my $inteloption="";
|
|
if ($isintel) {
|
|
$inteloption=" -o intelplus";
|
|
}
|
|
system "ipmitool -I lanplus$inteloption -U $username -P $password -H $bmc sol deactivate"; #Stop any active session
|
|
exec "ipmitool -I lanplus$inteloption -U $username -P $password -H $bmc sol activate";
|
|
|
|
|