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);