一个简单的auth perl程序

my @in_ip_yd=qw(....);
my @out_ip_yd=(....);

sub sync_auth_yd

{
    my ($in_ip,$out_ip) = @_; 
    my @in_ip = @$in_ip;
    my @out_ip = @$out_ip;
    foreach $var (@out_ip)
    {   
        my(undef,undef,$tmp,$out_suffix)= split /\./,$var;
        foreach $j (@in_ip)
        {   
            my(undef,undef,undef,$in_suffix)= split /\./,$j;
            if($in_suffix == $out_suffix)
            {   
                if(! -e $in_suffix)
                {   
                    mkdir $in_suffix or die "cannot make $in_suffix directory:$!\n";
                }   
                open $template,"<","auth_config.cnf.template";
                open $cnf,">","$in_suffix/auth_config.cnf";
                while(<$template>)
                {   
                    s/\$outip/$var/;
                    s/\$inip/$j/;
                    s/\$cliinip/$j/;
                    s/\$mport/10400/;
                    s/\$idc/1/;
                    s/\$port/4828/;
                    if($in_suffix == 97) 
                    {   
                        s/max_connection = 30000/max_connection = 20000/;
                        s/max_wait_list = 22000/max_wait_list = 19000/;

                    }   

               print $cnf $_;
                }
                close $template;
                close $cnf;
                #$tmp=`rsync -z $in_suffix/auth_config.cnf $j::gwconf/redis.rc --port=7874`;
                unlink "$in_suffix/auth_config.cnf";
                rmdir $in_suffix
            }
        }
    }
}

sync_auth_yd(\@in_ip_yd,\@out_ip_yd);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值