Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1864501
  • 博文数量: 283
  • 博客积分: 10141
  • 博客等级: 上将
  • 技术积分: 2931
  • 用 户 组: 普通用户
  • 注册时间: 2005-12-21 14:33
文章分类

全部博文(283)

文章存档

2013年(2)

2012年(2)

2011年(17)

2010年(36)

2009年(17)

2008年(18)

2007年(66)

2006年(105)

2005年(20)

分类:

2006-04-27 11:59:41

这个脚本和前面的“查看多节点lsload的状况”的功能相同,方法上做了一点修改。
效率更好一些,尤其是在节点多的情况下会好很多。谢谢lsload的关注,呵呵。

 
#!/usr/bin/perl
use strict;
use warnings;
my @nodes;
my $begin;
my $end;
my $lsload;
my $i;
if($ARGV[0] eq "")
{
        print("Usage:   $0 nodexxx-nodexxx\n");
        print(" $0 nodexxx\n");
        exit 0;
}
my $SOURCE=`. /usr/local/lsf/conf/profile.lsf`;
if($ARGV[0] =~ /node[0-9]{3}\-node[0-9]{3}/)
{
        @nodes =  split /\-/, $ARGV[0];
        $nodes[0] =~ /node([0-9]{3})/;
        $begin = $1;
        $nodes[1] =~ /node([0-9]{3})/;
        $end = $1;
        $lsload = `lsload node$begin`;
        print "$lsload";
        if($begin <=($end -1))
        {
                my $plsload=`lsload | grep -v HOST`;
                my @myplsload = split /\n/, $plsload;
                for($i = $begin+1; $i <= $end; $i ++)
                {
                        if($i < 10)
                        {
                                foreach (@myplsload)
                                {
                                        if($_ =~ /node00$i/)
                                        {
                                                print "$_\n";
                                        }
                                }
                        }
                        elsif($i >= 10 && $i < 100)
                        {
                                foreach (@myplsload)
                                {
                                        if($_ =~ /node0$i/)
                                        {
                                                print "$_\n";
                                        }
                                }
                        }
                        elsif($i >= 100 && $i <= 192)
                        {
                                foreach (@myplsload)
                                {
                                        if($_ =~ /node$i/)
                                        {
                                                print "$_\n";
                                        }
                                }
                        }
                        else
                        {
                                last;
                        }
                }
        }
}
elsif($ARGV[0] =~ /node[0-9]{3}/)
{
        $lsload=`lsload $ARGV[0]`;
        print $lsload;
        exit 0;
}
else
{
        print("Usage:   $0 nodexxx-nodexxx\n");
        print(" $0 nodexxx\n");
        exit 0;
}
阅读(3669) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~